Educational Codeforces Round 162 (Rated for Div. 2) - Virtual Participation Notes
Preface
This virtual contest didn't go as smoothly as expected. I spent longer than anticipated on problem B. For problem D, I identified the solution approach quickly but failed to account for several edge cases, resulting in three wrong submissions. Moving forward, I need to pay closer attention to edge cases during competition and work throu ...
Posted on Sat, 24 Oct 2026 16:19:20 +0000 by trystan
Strategies and Solutions for Codeforces Round 843 Div. 2 Problems
A. Gardener and the Capybaras
Given a string composed of characters 'a' and 'b', split it into three non-empty substrings. The goal is to make the middle substring lexicographically either the smallest or the largest among the three. Output any valid split or :( if impossible.
Approach:
The presence of only 'a' and 'b' is not restrictive. For t ...
Posted on Fri, 09 Oct 2026 16:19:07 +0000 by ben_m_gunn
Solutions to Educational Codeforces Round 162
This problem requires counting the number of zeros between the first and last occurrence of 1 in an array.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve() {
int n;
cin >> n;
vector<int> arr(n);
int firstOne = -1, lastOne = -1;
for (int i = 0; i < n; i++) {
...
Posted on Wed, 07 Oct 2026 16:56:53 +0000 by basil
Codeforces Round #EDR118 Editorial
A - Long Comparison
To compare two numbers represented as x1 * 10^p1 and x2 * 10^p2, first compare their total digit lengths: len(x1) + p1 vs len(x2) + p2. If unequal, the result is immediate. Otherwise, reduce both exponents by their minimum to ensure at least one becomes zero. Then scale the base integers accordingly and compare directly. Sin ...
Posted on Wed, 07 Oct 2026 16:44:20 +0000 by omniuni
CodeForces 1406 - Codeforces Round #670 (Div. 2) Editorial
Contest Overview
This round was relatively straightforward, so this editorial will focus on both the technical problem solutions and the interesting sequence of events during the contest.
Problem A - Subset Mex
Problem Statement: Given a set a with |a| = n, partition it into two sets A and B to maximize mex(A) + mex(B). Multiple test cases.
Con ...
Posted on Tue, 06 Oct 2026 16:45:21 +0000 by Brendan Nolan
Analysis of Selected Codeforces Problems: Tree Reconstruction, Interval Coverage, and Difference Constraints
CF472D: Reconstructing a Tree from Pairwise Distances
A key observation is that the vertex closest to node 1 must be its direct child. This serves as the foundation for a recursive reconstruction strategy.
Define a function check_subtree(v, parent) that attempts to build the subtree rooted at v. The logic relies on identifying the children of v ...
Posted on Mon, 05 Oct 2026 16:45:50 +0000 by eezmo
Counting Common Terms in Two Arithmetic Progressions Within a Range
Given two arithmetic progressions $A_i = a_1 i + b_1$ and $B_i = a_2 i + b_2$ for $i \in \mathbb{N}$, and integers $l \leq r$, determine how many integers $n \in [l, r]$ appear in both sequences.
We seek integer solutions $(x, y) \in \mathbb{N}^2$ to the equation:
$$
a_1 x + b_1 = a_2 y + b_2
$$
Rewriting gives the linear Diophantine equation:
...
Posted on Fri, 02 Oct 2026 16:01:46 +0000 by robster
Codeforces Round 1054 (Div. 3) Solutions
A. Be Positive
Count how many elements are negative. If the amount is odd, flip one more element so the product becomes positive.
void solve() {
int n; cin >> n;
int neg = 0;
for (int i = 0; i < n; ++i) {
int v; cin >> v;
if (v < 0) ++neg;
}
cout << (neg & 1 ? neg + 1 : neg) <&l ...
Posted on Tue, 29 Sep 2026 16:55:02 +0000 by cunoodle2
Competitive Programming Solutions: Graph Paths, DP, and Segment Trees
Problem A: Operations with Inversions
Greedy solution. Skipped for brevity.
Problem B: Optimal Shifts
Greedy solution. Skipped for brevity.
Problem C: Odd Process
Problem Statement: You have n numbers, each with a value a_i. You need to perform k rounds of operations where you can place a number into a bag (each number can only be placed once). ...
Posted on Tue, 29 Sep 2026 16:27:28 +0000 by Pilly
Connecting Employees Through Language Learning
Problem Overview
Given n employees and m available languages, each employee may know zero or more languages. Teaching a single language to a single employee costs 1 unit. The task is to determine the minimum total cost required so that every employee can communicate with every other employee (either directly or indirectly).
Understanding Commun ...
Posted on Tue, 29 Sep 2026 16:10:18 +0000 by sales@gmba.dk