XCPC Nanjing Regional Problem Solutions: B, G, and H
Problem B: What, More Kangaroos?
Operations 1 and 2 nullify eachother, as do operations 3 and 4. The problem reduces to applying positive integer operations on two buttons only, yielding four enumeration cases.
With operations 1 and 3 chosen, let operation 1 execute x times and operation 3 execute y times (x, y > 0). The goal is maximizing i ...
Posted on Mon, 06 Jul 2026 17:09:43 +0000 by jgetner
SMU Spring 2023 Trial Contest Round 9
A. Incorrect Subtraction
Simulate the process of subtracting 1 from the last digit of a number for k times. If the last digit is 0, remove it instead.
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
const int N = 2e3 + 10, mod = 1e9 +7;
typedef pair<int,int> PII;
int n,m,t,k;
vector<int& ...
Posted on Fri, 03 Jul 2026 16:28:51 +0000 by mella
Interactive Programming Problems: Writing, Testing, and Competing Strategies
Most interactive tasks in competitive programming use two primary interfaces: library-based (grader) calls common in domestic OI events and standard input/output (stdio) interactions seen on platforms like Codeforces. This content breaks down core implementation, local debugging workflows, problem-solving mindsets, and evaluation setup.
Core Im ...
Posted on Thu, 02 Jul 2026 16:22:15 +0000 by bluesoul
Codeforces Round 928 (Div. 4) Problem Solutions
Problem A: Character Frequency Analysis
Given a string of length 5 consisting only of characters 'A' and 'B', determine which character appears more frequently.
Input Format:
The first line contains an integer t (1 ≤ t ≤ 32) - the number of test cases
Each test case contains a single line with a string of length 5 containing only 'A' and 'B'
...
Posted on Wed, 01 Jul 2026 18:01:26 +0000 by billspeg
Codeforces Round 894 (Div. 3) Solution Analysis
Problem A
Given n strings each of length m, determine whether there exist four columns satisfying 1 ≤ i < j < k < l ≤ m such that these four columns contain characters 'v', 'i', 'k', 'a' respectively.
Approach: Iterate through columns left to right, searching for each required character sequentially. For each column, scan all strings t ...
Posted on Wed, 01 Jul 2026 16:54:31 +0000 by zhahaman2001
Segment Tree Techniques: From Basic Templates to Advanced Competitive Programming Problems
Basic Segment Tree with Lazy Propagation
The fundamental segment tree template maintains range sum with lazy propagation for range addition operations.
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
struct SegNode {
int left, right;
int64 sum;
int64 lazy;
};
class SegmentTree {
private:
static con ...
Posted on Sat, 27 Jun 2026 16:07:29 +0000 by oshecho
Educational Codeforces Round 161 (Div. 2) - Virtual Participation Summary
Preface
At first, I was stuck on Problem A for 20 minutes, which was a bit annoying. Then I noticed that more people had solved Problem E than Problem D, so I went for E, but it turned out that D was actually more suitable for me.
Sorting Problems: Prioritize problems that can be solved fastest based on the effort required. (Order of answering ...
Posted on Fri, 26 Jun 2026 17:49:15 +0000 by mubashir
Competitive Programming Problem Solutions: A Holiday Practice Log
Mock Contest Problem 1
Problem Overview
Converting the constraints reveals two key requirements for any valid set:
Must include the maximum power of each prime factor of n
Must contain at least one pair of distinct prime factors
Since the number of prime factors is much smaller than log(n), brute force search works effectively.
Approach: Incl ...
Posted on Fri, 26 Jun 2026 17:15:55 +0000 by obay
Shortest Path with Time-Based Road Blockages
Problem Overview
Given a graph with (n) intersections ((n \le 10^3)) and (m) bidirectional roads ((m \le 10^4)), a person named T moves first along a predetermined path (c_1, c_2, \ldots, c_g). Each road has a travel time (f[u][v]).
When T traverses a road, that road becomes blocked for the entire duration of T's crossing. Luka starts from inte ...
Posted on Tue, 23 Jun 2026 17:27:31 +0000 by Nick~C
Algorithmic Solutions for Competitive Programming Challenges
Challenging problems require innovative approaches to solve efficiently.
Short Colorful Strip
Given that n equals m, the final configuration must be a permutation of n.
Key observations:
When coloring an interval, the smallest color within that interval is always colored first.
The coloring operation requires all points in the covered interval ...
Posted on Tue, 23 Jun 2026 16:50:12 +0000 by girishn