
Every other problem in the contest is rated except for these three, it's been like this for a month.
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | jiangly | 3631 |
| 4 | Kevin114514 | 3574 |
| 5 | maroonrk | 3521 |
| 6 | strapple | 3515 |
| 7 | Radewoosh | 3461 |
| 8 | tourist | 3428 |
| 9 | turmax | 3378 |
| 10 | Um_nik | 3376 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 161 |
| 2 | adamant | 147 |
| 3 | Um_nik | 145 |
| 4 | Dominater069 | 142 |
| 5 | errorgorn | 140 |
| 6 | cry | 138 |
| 7 | Proof_by_QED | 136 |
| 8 | YuukiS | 135 |
| 9 | chromate00 | 134 |
| 10 | soullless | 133 |

Every other problem in the contest is rated except for these three, it's been like this for a month.
Since once hasn't been released, and I love procrastinating on stuff that I probably should have already finished, I thought I might make one. I also don't know why the links to the problems aren't working, blame CF. Apologies if anything is unclear, I'm tired.
[contest:2218A]
Since $$$min(x, y) \lt = x$$$, and $$$x \leq 67$$$, we can set $$$y = 67$$$, so $$$min(x, y)$$$ will always equal $$$x$$$
[contest:2218B]
The optimal choice is to multiply every value except the largest value by -1, since they have the least contribution to the sum.
[contest:2218C]
For a given "block" of length 3, we will be "wasting" the largest and smallest element in our block. In order to maximize the sum of the medians of the block, we note that the largest element in an array can never be the median, so we pair the largest element with the second largest element so that the second largest element is the median, and finally pair those with the smallest element. Repeat until no more elements are in the array.
[contest:2218D]
Let $$$p_i$$$ denote the $$$i$$$-th largest prime. $$$gcd(p_i * p_{i+1}, p_{i+1} * p_{i+2}) = p_{i+1}$$$, so if we output the products of adjacent primes, then the sequence formed by our gcds will be monotonically increasing, and therefore contain no duplicates. The primes can be generated using a sieve, but make sure to use 64 bit integers.
It can also be shown that outputting adjacent odd numbers has the same result, but I didn't come up with that in contest.
[contest:2218E]
Note that $$$x \oplus x = 0$$$. Using this fact, we can show that only the last operation has any effect. To prove this, consider any operation that is not the last operation. Let $$$x$$$ be the selected value in the operation. If $$$a_i$$$ is set to $$$a_i \oplus x$$$ for all $$$i$$$, then the next operation will have a selected value of $$$a_j \oplus x$$$, meaning each element will be set to $$$a_i \oplus a_j \oplus x \oplus x$$$ since every element was XORed with $$$x$$$ in the previous operations. This means that the $$$x$$$s cancel out, and we're left with $$$a_i \oplus a_j$$$.
Using this, we can simply find the maximum XOR of any pair of elements in $$$O(N^2)$$$ time.
[contest:2218F]
For any arbitrary tree, We can show that the number of nodes where its subtree size is even $$$\leq$$$ the number of nodes where its subtree size is odd. For any node with an even number of nodes in its subtree, it must have at least one child node, and that child node's subtree size will be odd. Therefore, $$$x \leq y$$$.
If $$$x = 0$$$, then $$$y \mod 2$$$ must be $$$1$$$ trivially. For this case, just output a star graph with all nodes connected to node $$$1$$$.
Otherwise, the following construction always works: Output $$$2 \cdot x$$$ nodes such that node $$$i$$$ is connected to node $$$i+1$$$. We now have $$$x$$$ nodes with an even subtree size and $$$y$$$ nodes with an odd subtree size. Finally, to get rid of the remaining $$$y - x$$$ nodes, we can attach them to node $$$1$$$ (if $$$y - x$$$ is even) or node $$$2$$$ (if $$$y - x$$$ is odd).
[contest:2218G]
Let $$$s_i$$$ be the number of people sitting down after the $$$i$$$-th second (i will be using seconds since its simpler to write). First, seat everyone who sits down at time $$$0$$$. Then, iterate over seats in the order of the time when they sit down.
Let the current seat be $$$x$$$ and the current second be $$$t$$$. Additionally, let $$$b$$$ be the first second when one of $$$x$$$'s neighbors sits down.
If none of the neighbors of $$$x$$$ have sat down before $$$t$$$, there is no possible array.
If $$$t = b + 1$$$, then we can assume that the reason why person $$$x$$$ didn't sit down was because none of their neighbors were sitting down, so $$$a_x$$$ can be anything between $$$1$$$ and $$$s_{t-1}$$$.
Otherwise, $$$a_x$$$ must be between $$$s_{t-2} + 1$$$ and $$$s_{t-1}$$$, since the reason why person $$$x$$$ didn't sit down was because they were waiting for more people to sit down.
Since the $$$a_x$$$'s are independent of eachother (the only thing that matters is when they sit down), we can simply multiply all the possibilities together.
(note, my implementation for this problem was really bad, I kinda overcomplicated it in my head) 369716131
My apologies if this has already been raised, or if the Codeforces team is already aware of this issue, but when building a package on Polygon, the statement is not updated on Codeforces.
Weirdly enough, when updating the testset, Codeforces is able to update that just fine, but if one of the changed test cases in contained in the statement as a sample, the testcase is only updated in the testset, and the change is not reflected in the statement.
EDIT: It seems like other people are unable to access the problem at all: "Can't read or parse problem descriptor".
This blog post is inspired by RobinFromTheHood's blog post.
After Codeforces Round 1074 (Div. 4) ended, I received many questions about how to write a contest along with how the proposal process works, so I thought that I might write a blog post all about it. I'll be mentioning different problems I made throughout the round setting process, and copying from this post, I'll be denoting final problems in bold, and I'll be denoting the $$$n$$$-th iteration of a problem by putting that many apostrophes after it: e.g A' is the first iteration of problem A, A'' is the second, and so on. Similarly, I won't go into detail about why a problem wasn't used.
I started competitive programming on Codeforces in the summer of 2024, though I had dipped my toes into it with some in person competitions and Advent Of Code before then; even before that, I used to practice coding on sites like Codewars. Even back then, I was thinking of problems: I came up with problems B' and C' back in November 2024.
Sometime in March, I made problem F', and planned to propose it to USACO, though I ended up getting cold feet and not submitting it.
Sometime during April, I decided to try writing a contest for Codeforces, inspired by RobinFromTheHood's blog post about making his own round. I had initially planned to propose the round as a Div3 (to the person who commented that this round feels like a Div3 shifted over by one problem, you're partly correct on that :) ). During the summer, I made problems A', D', and E', G'. I didn't really like G', so I scrapped it and thought the problemset would be good for a Div4, and I turned problems A', B', C', D', E', F' into B, C, D'', E'', F'', and G. I added A to finish the problemset. I had made a rough preparation of the problems in Polygon.
My first thought was to send a message to Vladosiya, thinking that I could do the same thing as RobinFromTheHood when proposing his round. However, I was unable to get in contact with him and after a couple of weeks of being left on unread, I decided to dm cry, who accepted the proposal. After waiting for him to get to the next arena in Clash Royale do his very important coordinator work, he rejected problem E'', accepted problem E''', changed D'' into D''', and made a couple of other changes. After the problemset was approved, I prepared my problemset completely in Polygon, and we went off to the testing phase.
I won't go too much into detail on this, but we removed F'' and moved E''' to F because testers thought it was too difficult to just be an E. When trying to come up with a new E, I came up with H. Finally, I came up with E (or rather buffed a problem that I had thought of a while back), which after some internal back and forth, was accepted.
A week before the round, I learned that D'' was already used in another contest a while back, and since D''' was just a buffed version of D'', we removed it from the round, and I took another idea I had a while back and turned it into D
Confusing? I know, I suck at writing. Anyways, here's a AI summary since I'm too lazy to rewrite the above section
The Final Lineup
A: New problem added to complete the initial Div 4 proposal. B: Originally A' (Summer 2025). C: Originally B' (Nov 2024). D: A separate idea from "a while back" (substituted one week before the round). E: A buffed version of an old idea (accepted after internal debate). F: Originally E''' (created during review) → moved to F due to difficulty. G: Originally F' (Mar 2025). H: Newly created during the testing phase (while attempting to create E).
The Graveyard (Scrapped/Rejected)
D''' (evolved from D'' ← C'): Removed one week before the round because D'' was found to be a duplicate of an existing problem. E'' (from D'): Rejected by the coordinator. F'' (from E'): Removed during testing. G': Scrapped by me before the proposal
I was super excited for the round, and when it finally started, it was a bit hectic but also super fun!
I was admittedly nervous about something going terribly wrong with the contest; my main concern was with problem H, where I worried that the internal solution would TLE or that something else would go wrong. With that being said, almost everything went well; there was an pretty major issue in regards to one of the problems, but it thankfully affected a negligible number of solutions (if you were affected, you should have been contacted), and there was also a typo in a statement. Huge thanks to golomb and ThatOnePythonUser for catching these issues.
As one would probably expect from a Division 4 round, there were a lot of cheaters. The automated cheating checks haven't run yet, but once they do, you should expect to see most cheaters removed from the leaderboard (and then I'll go and purge some more once that's done). For reporting cheaters after the automated checks, DM me about them and I'll try to investigate.
I've seen a lot of complaints about problem difficulty, and while I agree the problems are a bit harder, I don't believe the difficulty was super unfair; with that being said, I'm aware that H was very much on the harder side for a div4 (though not unheard of, looking at Codeforces Round 971 (Div. 4)). I fully didn't expect there to be many H solves, and if you want to ignore it, A-G already makes a full div4 problemset. H is there to challenge out of competition solvers along with provide participants with a hard problem to upsolve (I fully encourage you to try it, while there are many different solutions, the editorial solution doesn't require any complex data structures and is really nice!). With that being said, I think the estimated difficulty of H is 2200, though looking at other platforms, it seems I may have underestimated the difficulty.
Also, if I didn't respond to your private message, my apologies, CF is really restrictive on the amount of people I can send DMs to, so it creates a bit of a hassle. Also, a lot of them were asking how to set a round, which I'm covering in here.
Finally, apologies for the hacks (primarily on E); I didn't think an edgecase that a lot of people dealt with.
I'll be talking about Div3 / Div4 rounds below. I'm not super famililar with the proposal process for Div 1/2 rounds, though note that in order to propose a Div 1 / Div 2 round, you must either have a rating of 2100+ or have previously set a round.
I'm also going to discuss my way of proposing it and my recommendations. I do know that many people propose a contest before having a problemset finished; I don't personally feel like this is the best way to go, but that might just be a me thing. With that being said, if you have no previous problemsetting experience, I'd encourage you to at least think of problems before submitting a proposal; it might be a bit awkward if you've proposed a contest that you can't come up with problems. I acknowledge that setting one contest doesn't make me an expert at all, and if anyone with more experience would like to correct me, please do.
Firstly, don't cheat. I doubt a single coordinator is going to work with you if you've recently / you're actively cheating in contests. Now that I've eliminated half of the people reading this, let me continue.
Secondly, you need to gather a problemset. For Div3 / 4, you need 7 — 8 problems. A couple of notes about these problems:
Additionally, note that making problems isn't trivial, and it can often take you time to come up with good problems, so don't worry if you're struggling. There are many ways to make problems; for the div4, they came from a combination of modifying other problems (for example, 2185G - Mixing MEXes was made by modifying https://usaco.org/index.php?page=viewproblem2&cpid=1492 ), problems just popping into my head (e.g 2185D - OutOfMemoryError), along with actively working and trying to come up with a problem (kinda 2185E - The Robotic Rush) .
Then, once you have a problemset, you should probably get someone to review the problemset before you propose it. This can be a friend or otherwise someone you trust; I'm willing to review them, just DM me on Discord (idk if I want to post my username publicly here, but you can just dm me and I'll send it) or Codeforces.
Finally, you can propose it to a coordinator, of which there are 3 (that I know of at least): cry, soullless, and Vladosiya. They'll guide you from there.
I really hope this blog inspires you to give writing a contest a shot; it's an amazing experience (plus, we all know we need more Div4 rounds :) ). If you have any questions, please leave a comment or DM me.
Thank y'all so much for participating in my first Codeforces round! Special thanks to AksLolCoding for suggesting a major change to problem D and Intellegent for helping to rewrite the statement of problem F.
Fix an integer $$$x$$$, how could you find out the value of $$$y$$$?
Square both sides of the equation, for what values of $$$x$$$ is $$$x^2$$$ an integer?
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
for (int i = 0; i < n; i++) cout << i+1 << " ";
cout << "\n";
}
}
If we were to change the problem such that you could perform as many swaps as you wanted, the answer would remain the same.
Once our running sum encounters the maximum element of the array, the max of that prefix will always be the maximum element of the array.
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> vec(n);
for (auto &x: vec) cin >> x;
cout << *max_element(vec.begin(), vec.end()) * n << "\n";
}
}
Duplicate values don't matter, nor does the order of the elements.
Let's consider the inverse problem, where we have a array that is equal to [$0, 1, 2, \ldots, k-1$] and we can add $$$x$$$ to each value in the array. No matter which value of $$$x$$$ we choose, the values in $$$a$$$ are consecutive.
In order for the MEX to be greater than 0, 0 has to be contained in the array.
Since there are at most $$$3000$$$ elements in $$$a$$$, there are $$$3000$$$ possible values of $$$x$$$ that have a MEX greater than 0.
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> vec(n);
for (auto &x: vec) cin >> x;
sort(vec.begin(), vec.end());
// Remove duplicates
vec.erase(unique(vec.begin(), vec.end()), vec.end());
n = vec.size();
int best = 0;
int current = 0;
for (int i = 0; i < n; i++) {
if (i == 0 || vec[i] != vec[i-1]+1) {
current = 0;
}
current++;
best = max(best, current);
}
cout << best << "\n";
}
}
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> vec(n);
for (auto &x: vec) cin >> x;
sort(vec.begin(), vec.end());
int best = 0;
for (auto &x: vec) {
int next = 0;
for (int i = 0; i < vec.size(); i++) {
if (vec[i]-x == next) next++;
}
best = max(best, next);
}
cout << best << "\n";
}
}
Clearly, resetting all of the values is too slow, but we don't have to update all the elements at the same time.
If an element hasn't been modified after the last crash, it's value in the final array is the same as its value in the original array.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int t;
cin >> t;
while (t--) {
int n, m, k;
cin >> n >> m >> k;
vector<int> vec(n); for (auto &x: vec) cin >> x;
vector<int> original_vec(n); for (int i = 0; i < n; i++) original_vec[i] = vec[i];
vector<int> last_element_update(n, -1);
int last_reset = -1;
int reset_count = 0;
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
a--;
if (last_element_update[a] < last_reset) vec[a] = original_vec[a];
vec[a] += b;
if (vec[a] > k) {
last_reset = i;
reset_count++;
vec[a] = original_vec[a];
}
last_element_update[a] = i;
}
ll sum = 0;
for (int i = 0; i < n; i++) {
if (last_element_update[i] < last_reset) vec[i] = original_vec[i];
cout << vec[i] << " ";
}
cout << "\n";
}
}
Each robot's movements is independent of another robot's movements.
We only need to care about the spikes directly to the right and left of the robot, if they exist.
To figure out when a robot dies, we don't need to care about the position of the robot, only the distance to its left and right spikes.
We only care about the left-most a robot has been and the right-most a robot has been.
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, m, k;
cin >> n >> m >> k;
vector<int> robots(n); for (auto &x: robots) cin >> x;
vector<int> lava(m); for (auto &x: lava) cin >> x;
vector<bool> dead(n);
map<int, vector<int>> death_locations;
string instructions;
cin >> instructions;
sort(lava.begin(), lava.end());
for (int i = 0; i < n; i++) {
if (lava[0] < robots[i]) {
int left_dist = robots[i] - (*(lower_bound(lava.begin(), lava.end(), robots[i]) - 1));
death_locations[-left_dist].push_back(i);
}
if (lava[m-1] > robots[i]) {
int right_dist = *lower_bound(lava.begin(), lava.end(), robots[i]) - robots[i];
death_locations[right_dist].push_back(i);
}
}
int current_pos = 0;
int alive = n;
for (auto &x: instructions) {
if (x == 'L') current_pos--;
else current_pos++;
for (int i: death_locations[current_pos]) {
if (dead[i]) continue;
dead[i] = true;
alive--;
}
death_locations[current_pos].clear();
cout << alive << " ";
}
cout << "\n";
}
}
A single cow will only face $$$n$$$ matches.
XOR is cumulative, meaning the order of the cows in a stack doesn't change its skill level.
Similarly, the order of the cows in the stack doesn't change the final position of the cow who was given the potion in the final line.
You can calculate range XOR queries in O(1) using prefix sum.
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, q;
cin >> n >> q;
int num_cows = (1<<n);
vector<int> cows(num_cows); for (auto &x: cows) cin >> x;
vector<int> prefix(num_cows); prefix[0] = cows[0];
for (int i = 1; i < num_cows; i++) {
prefix[i] = cows[i] ^ prefix[i-1];
}
while (q--) {
int cow_idx, skill_level;
cin >> cow_idx >> skill_level;
cow_idx--;
int curr_position = 0;
for (int i = 0; i < n; i++) {
int size = (1<<i);
int leader_idx = cow_idx / size;
int leader_value = prefix[(size)*(leader_idx+1)-1] ^ (leader_idx == 0 ? 0 : prefix[(size)*(leader_idx)-1]);
leader_value ^= cows[cow_idx];
leader_value ^= skill_level;
int enemy_value;
if (leader_idx % 2 == 0) {
enemy_value = prefix[(size)*(leader_idx+2)-1] ^ prefix[(size)*(leader_idx+1)-1];
}
else {
enemy_value = prefix[(size)*(leader_idx)-1] ^ ((leader_idx-1) == 0 ? 0 : prefix[(size)*(leader_idx-1)-1]);
}
if (leader_value < enemy_value || (leader_value == enemy_value && leader_idx % 2 == 1)) {
curr_position += size;
}
}
cout << curr_position << "\n";
}
}
}
The only time adding an element changes the MEX of an array is if the added element is equal to the MEX of the array.
For a given element, the element is removed $$$n - 1$$$ times, and the element is added to another array $$$n - 1$$$ times.
We can treat removing an element from the array and adding it to another array as two separate interactions.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> lengths(n);
vector<vector<int>> arrays(n);
map<int, int> count;
for (int i = 0; i < n; i++) {
int length;
cin >> length;
lengths[i] = length;
arrays[i] = vector<int>(lengths[i]);
for (auto &x: arrays[i]) {
cin >> x;
count[x]++;
}
sort(arrays[i].begin(), arrays[i].end());
}
int mex_sum = 0;
vector<int> mexes(n);
vector<int> second_mexes(n);
// Calculate mex and second mex for each array
for (int i = 0; i < n; i++) {
int current_mex = 0;
for (int j = 0; j < lengths[i]; j++) {
if (arrays[i][j] > current_mex) break;
if (arrays[i][j] == current_mex) current_mex++;
}
int second_mex = current_mex+1;
for (int j = 0; j < lengths[i]; j++) {
if (arrays[i][j] > second_mex) break;
if (arrays[i][j] == second_mex) second_mex++;
}
mexes[i] = current_mex;
second_mexes[i] = second_mex;
mex_sum += current_mex;
}
ll total = 0;
// Calculate removals
for (int i = 0; i < n; i++) {
for (int j = 0; j < lengths[i]; j++) {
ll org = total;
bool is_alone = (j == 0 || arrays[i][j-1] != arrays[i][j]) && (j == lengths[i]-1 || arrays[i][j+1] != arrays[i][j]);
if (is_alone && arrays[i][j] < mexes[i]) total += ((ll)(mex_sum-mexes[i]+arrays[i][j]))*(n-1);
else total += (ll)(mex_sum) * (n-1);
}
}
// Calculate additions
for (int i = 0; i < n; i++) {
total += (ll)(count[mexes[i]])*(second_mexes[i]-mexes[i]);
}
cout << total << "\n";
}
}
I had originally proposed this problem with a subtask to solve for Cow 0 only, try that.
Trivially, a cow must cheat when it loses a match, and a cow shouldn't cheat if it can win a match
Simulate the process for Cow 0 starting at position 0. If Cow 0 wins all of its matches in under $$$k$$$ cheats, Cow 0 can win all of its matches.
If we simulate the process for Cow 0 starting at position 0, no matter which position Cow 0 starts, after $$$k$$$ matches, if Cow 0 has already had a match, its skill value would be the same no matter in which position it initially started.
A cow can always win its first match using at most one hint, and so if there's another earlier position where Cow 0 had already used a cheat and won all of its matches, Cow 0 can also win in this new position.
Going back to the second hint, if Cow 0 used over $$$k$$$ cheats (let's call the number of cheats used $$$m$$$), Cow 0 can only win if its first match's match number is greater than or equal to the round number where Cow 0 at position 0 has used its $$$m - k$$$-th cheat.
Now we're down to the case we used exactly $$$k$$$ cheats. Let's denote the last position where Cow 0 can win its first match without cheating as $$$b$$$ (which is the first index where the sum of all the skill levels of the cows before is less than the skill level as cow 0). Using hint 3, this means that all the positions less than or equal to $$$b$$$ are also winning positions.
Finally, using hint 4, if Cow 0's first match is the same match or after the match where Cow 0 at position 0 could used its first cheat, cow 0 can win at that new position. Note that if $$$k = 0$$$, we can ignore this step.
We can simulate each cow as if it started as position 0.
A cow only needs cheat at most $$$\log(max(a_i))$$$ times, since its skill level is (at least) double after each cheat.
Prefix sums, binary search, and helper methods are your friend.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int t;
cin >> t;
int test_num = 0;
while (t--) {
int n, k;
cin >> n >> k;
test_num++;
vector<ll> skill_levels(n); for (auto &x: skill_levels) cin >> x;
vector<ll> prefix(n); prefix[0] = skill_levels[0];
for (int i = 1; i < n; i++) prefix[i] = skill_levels[i] + prefix[i-1];
auto sum_without_index = [&](int l, int r, int i) {
if (r < l || r < 0 || l < 0) return 0ll;
ll val = prefix[r] - (l == 0 ? 0 : prefix[l-1]);
if (r < i) return val;
if (l > i) {
r++;
l++;
return prefix[r] - (l == 0 ? 0 : prefix[l-1]);
}
else {
r++;
return prefix[r] - (l == 0 ? 0 : prefix[l-1]) - skill_levels[i];
}
};
auto bs_for_prefix = [&](ll target, int ignoring) {
int lo = 0;
int hi = n - 1;
while (lo <= hi) {
int mid = lo + (hi - lo) / 2;
if (mid == 0 || sum_without_index(0, mid-1, ignoring) < target) {
lo = mid + 1;
}
else {
hi = mid - 1;
}
}
return hi;
};
vector<int> answer(n);
for (int i = 0; i < n; i++) {
int last_starting_position = bs_for_prefix(skill_levels[i], i);
vector<int> bad_positions;
int pos = -1;
while (true) {
ll value = sum_without_index(0, pos, i) + skill_levels[i];
ll pos_of_bad = bs_for_prefix(value * 2 + 1 - skill_levels[i], i);
if (pos_of_bad >= n - 1) break;
value = sum_without_index(0, pos_of_bad-1, i) + skill_levels[i];
bool bad_position = sum_without_index(pos_of_bad, pos_of_bad, i) > value;
if (bad_position) {
bad_positions.push_back(pos_of_bad + 1);
}
pos = pos_of_bad;
}
if (k == 0) {
if (bad_positions.size() == 0) answer[i] += last_starting_position + 1;
}
else if (bad_positions.size() > k) {
answer[i] += n - bad_positions[bad_positions.size() - k];
}
else if (bad_positions.size() < k) {
answer[i] += n;
}
else {
answer[i] += min(n, (last_starting_position + 1) + (n - bad_positions[0]));
}
}
for (auto &x: answer) cout << x << " ";
cout << "\n";
}
}
I am delighted to invite you to the first Div. 4 round of the year: Codeforces Round 1074 (Div. 4)! The round is scheduled for Jan/18/2026 17:35 (Moscow time). You will be given 7 — 8 problems to solve (all authored by me), and 2 hours and 15 minutes to solve them.
The format of the event will be identical to Div. 3 rounds:
ICPC rules with a penalty of 10 minutes for an incorrect submission.
12-hour phase of open hacks after the end of the round (hacks do not give additional points).
After the end of the open hacking phase, all solutions will be tested on the updated set of tests, and the ratings will be recalculated.
Only trusted participants of the fourth division will be shown in the official standings. To be a trusted participant, you must:
have participated in at least 5 rated rounds where you have solved at least one problem.
have a rating less than 1400.
Regardless of if you are a trusted participant or not, this round will be rated for you if you
have a rating of less than 1400 or are unrated.
do not select the "Register as unrated" option when registering for the contest.
Participants who are rated 1400+ are not allowed to create a new account for the purpose of competing officially. We encourage you to take part unofficially.
We would like to remind all participants about the rule against using artificial intelligence tools during the contest. Violators will be sent to cry's basement; we spent a long time expanding it so we could host this round, and we sincerely hope that it won't be filled back up again.
I would like to thank:
cry for being an incredible coordinator, and for giving me a chance to write this contest.
Vladosiya for translating the problems into Russian.
cduckling for looking over the initial problemset before I officially proposed it.
Our red testers: __baozii__, Intellegent
Our golden testers: Arpa, -firefly-, AksLolCoding, Edeeva, Friedrich, omsincoconut, Proof_by_QED, temporary1
Our purple testers: macaquedev, pop, tin.le2, wuhudsm
Our blue testers: apollo07, Argentum47, Eikyu, Ermiooo159, expertaq, Jteh, ritam1234, simplelife, SpyrosAliv, susvent, Vladosiya
Our cyan tester: anandswaroop191
Our gray testers: DraxLab, piman51277
Our unrated tester: qdread
MikeMirzayanov for creating Codeforces, Polygon, and testlib.h.
You, for participating!
I wish you all the best of luck in this competition, and I hope you enjoy the problems!
Please think deeply about this problem, and write a solution using C++. Make sure to use map and set vs the unordered equivalents. Whenever you come up with a solution, ensure that it is correct and that it works within the constraints provided. Test your code on the samples along with generated cases + edge cases that could occur. If you are out of ideas, try and think some more, step by step.
Overall, R1 performed fairly well, especially for an opensource model that was made as a side project. The pitfalls it did have were similar to o1, though it also had the issue of not following instructions at times. Additionally, for the 800-1200 rated problems, I used screenshots to send the statement, but it misread the screenshot during "Maximize MEX", and I had to switch to copy and pasting the statement into the text box.
With that being said, the model, while very impressive, doesn't seem to show anything we haven't seen before with o1, and I doubt any radical changes will have to be made to reduce cheating, similar to what happened when o1-mini initially released. We've already started to see problemsetters attempt to reduce GPT cheating (see the round 1000 Anti-LLM report), and assuming this becomes more of a trend in the future, the ability to cheat with these tools should hopefully be diminished to a large degree (at least until o3 comes out, but that's another story)
As a quick side note, LLMs are not deterministic, meaning your results might not be the same as mine here (though I'd suspect them to be fairly similar).
| Name |
|---|


