Блог пользователя wakanda-forever

Автор wakanda-forever, история, 4 недели назад, По-английски

Hello Codeforces!!!

We are delighted to invite you to participate in Codeforces Round 1095 (Div. 2), which will be held on Apr/28/2026 17:35 (Moscow time). You will be given $$$7$$$ problems, including one split into two subtasks (not necessarily placed adjacently), and $$$2$$$ hours $$$15$$$ minutes to solve them. This round will be rated for the participants with a rating lower than 2100.

The problems are authored and prepared by wakanda-forever and wuhudsm.

The scoring distribution is as follows:

A B C D E F G
$$$500$$$ $$$750$$$ $$$1500$$$ $$$2000$$$ $$$2500$$$ $$$2500$$$ $$$2500$$$

We would like to express our sincere thanks to the following individuals for their contributions and for making this round possible:

We hope you take part in the round and enjoy solving the problems. Good Luck and Have Fun!

UPD: Hacks will be disabled for the problems A to E.

UPD: Editorial

UPD: Congratulations to the winners!!!

Top 5 overall:

Top 5 rated participants:

First solves:

  • Проголосовать: нравится
  • +192
  • Проголосовать: не нравится

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by wakanda-forever (previous revision, new revision, compare).

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится

As as tester, testing this round allowed me to test the testing of tested rounds which were tested by testing testers

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

As a tester, this round tested me

»
3 недели назад, скрыть # |
 
Проголосовать: нравится -48 Проголосовать: не нравится

I'm not a tester.

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by wakanda-forever (previous revision, new revision, compare).

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

obligatory tester comment.

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

I also tested

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +69 Проголосовать: не нравится

All cheaters will face the punishment shown in wakanda-forever's profile picture

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

As a tester, I was forced to post a tester comment. So I decided to post the most cringy one I could think of.

image

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

As a tested tester , I procrastinated at the problems for at least 67 minutes.

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

Wow it's very hintive that the score of E,F,G are same...

Are you serious?is that meaning their difficulty are identical.It's lack of probability.

Anyway,hope to get more rating!

  • »
    »
    3 недели назад, скрыть # ^ |
     
    Проголосовать: нравится +25 Проголосовать: не нравится

    I'm not a tester, so this is purely speculation. But based on the announcement, one possibility is that G is a supertask of a prior problem (since there are non-adjacent subtasks). In this case, it would stand to reason that G is much harder than E and F, despite the same scores.

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

Hopefully, the problem statement will be short and precise just like the announcement

»
3 недели назад, скрыть # |
 
Проголосовать: нравится -25 Проголосовать: не нравится

Seeing same scores for E, F and G imply that G is definitely a subtask (hard version).

»
3 недели назад, скрыть # |
 
Проголосовать: нравится -13 Проголосовать: не нравится

All cheaters will face the punishment shown in wakanda-forever's profile picture

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

10/10 would test again

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

As a linger, I usually go to sleep early.

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

The problem statement should be given more clearly.

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

are there interactive?

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hope it is gonna be fun unlike the last spectral cup!

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by wakanda-forever (previous revision, new revision, compare).

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

why no extra registration? :(

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

the problem A was very funny. ._.

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How did more than a thousand people solve D, even tho E looks easier, and D looks way harder than C?

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

problem C is quite interesting

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Please if someone can give hint for C :)

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem G >>>

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

C >> D

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by wakanda-forever (previous revision, new revision, compare).

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

https://mirror.codeforces.com/contest/2226/problem/A Solution : Take all 1s and the last number if it's not 1. Then take every single index one by one. This is the most optimal solution.

https://mirror.codeforces.com/contest/2226/problem/B Solution : Good subarray can only be of size 2 and difference of numbers is equal to minimum.

https://mirror.codeforces.com/contest/2226/problem/C Approach : For every i calculate the maximum mex you can construct from it and then make a sorted list by inserting a new maxmex on every iteration. And also make one list with index of each. Finally, for every i from 0 to size. Iterate the sorted list and find the first value smaller than or equal to i or if any index contains the i value itself then increase i by 1. Repeat until we reach size or end of the sorted list. i will be the maximum mex.

https://mirror.codeforces.com/contest/2226/problem/E Idea : How to calculate for every prefix quickly? We can keep track which index converts to which number(mex) in the array. Let's call it the tracking array. What if we calculate the tracking array for the whole array first then start deleting last index and keep updating the tracking array accordingly to get the maximum mex?

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

$$$C$$$ is good, but how to solve $$$E$$$? I was thinking something using Segment Tree to set and get prefix maximums and do some greedy pairing? Like try to pair $$$i$$$ with element $$$i$$$, or another smaller element and so on?

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hint for C, please. I tried a greedy approach, but I don't think greedy would work here. DP may work. My greedy solution was: for every possible $$$\text{MEX}_i$$$ where $$$i \in {0, 1, 2, \ldots, n}$$$, I would check what the options are for $$$\text{MEX}_i$$$. The options were either the same element as $$$\text{MEX}_i$$$, the element $$$2 \cdot \text{MEX}_i$$$, or some larger integers. Greedily, in my first attempt I prioritized the first option over the second, and in my second attempt I reversed the priority. Neither worked.

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Problem titles are interesting. Thanks for the contest.

»
3 недели назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

I did c by binary search got idea fast but implementation took time

for given mid

Note max (mex-1 ) is mini(n-1, max+1)

iter map reversly from large to small till > mid

all elements x > mid they can be used to fill for elemnts < (x+1 / 2 ) -1 store this in an array p[(x+1 / 2 ) -1] = map[x]

available_replacement = 0 now iterate from mid to 0 if element already exists or use from counter

and update counter + p[i] also we can use if more elements present update p[(i+1)/2-1] = m[i]-1

available_replacement + = p[i] if we can reach till zero then it is possible

heres my solution

https://mirror.codeforces.com/contest/2226/submission/372870212

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

i should have gotten the idea for E earlier :(

»
3 недели назад, скрыть # |
Rev. 2  
Проголосовать: нравится +7 Проголосовать: не нравится

cf contests without cheaters is such a delight...no inflated solve count

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I've spent 2 hours on C, but for some strange reason the output in the cf tester differed with the output in my IDE. Like sometimes the tester would give me WA on the first test, although I would get the correct output in my IDE. In an online compiler I also get the correct answer. What can be the reason for that? I also asked it during the contest, but did not get an answer

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Made a fun use of subproblems (C & E) today to save some time and score.

After solving C, when solving E, we can first write a quadratic solution, print the last answer instead of the whole array, and submit it as problem C to check correctness.

Now, if it got OK, the score for problem C would suffer. However, the outcome won't be OK: it will be either WA if the logic is wrong, or TL if the logic is right until the larger tests come. So, it's a free check to save some testing time.

When we get TL instead of WA, we can proceed to speed up the quadratic solution, now most surely right but slow, using the data structures. And then submit it as E.

»
3 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

»
3 недели назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Which rating change extension are you using? I’ve been using the Carrot extension, but it hasn’t been working for the last two contests and keeps showing an error:

Error: Uncaught Error: Uncaught Error: CF API: HTTP error 400: {"status":"FAILED","comment":"contestId: You have to be …
»
2 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I think C is much more difficult than D.After solving A,B and D,I spent all the rest time on C and got nothing besides "-5".Maybe I am too stupid.

»
2 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by wakanda-forever (previous revision, new revision, compare).

»
2 недели назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

By the way, my arm was broken)

»
2 недели назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Carrot, Repovive's Predictor and even CF Predictor are completely dead. Someone in the comments of one of the prev blogs told me that the "probrat" command from Limak Discord bot is also not working. Anyone got a working alternative?

»
13 дней назад, скрыть # |
 
Проголосовать: нравится -10 Проголосовать: не нравится

MikeMirzayanov and the Codeforces team, I am writing this comment to appeal against the plagiarism flag on my solution 372871538 for problem 2226C. I believe this is a false positive. The approach I used — binary search on the answer combined with a greedy check — is a completely standard technique for MEX-type problems that many contestants naturally and independently arrive at. The fact that 200+ solutions were flagged simultaneously strongly suggests that the plagiarism checker has detected a common algorithmic pattern rather than actual copying. My code was written entirely by me during the contest. My personal template with my name (TheAlgoForge) is clearly visible at the top of my submission, which I believe reflects that this is genuinely my own work. I did not share my code on any public platform such as ideone or pastebin at any point during or before the contest. I also want to be transparent — I noticed my greedy implementation had a bug (using the largest available element instead of the smallest valid element > 2x), which may have ironically increased structural similarity with other contestants who independently made the same logical mistake while thinking through the problem. Codeforces is a very important platform for my journey as a competitive programmer. Every contest and every problem means a great deal to me, and I would never compromise my integrity by cheating. Being flagged for something I did not do is truly disheartening. I sincerely request the admins to review this case carefully. Thank you for your time and consideration. — TheAlgoForge

»
13 дней назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

My submission 372847551 for problem D recently got flagged for similarity to 372859404. I believe this is purely a coincidence: I do not know such user and have arrived to the solution and implementation completely on my own, without any kind of external help. I also exclusively used local IDEs, and there is no way another person could possibly have access to the code. I have a screen recording of the entire contest, which I would be happy to provide. I kindly request to review the case.

»
10 дней назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I am writing this to the codeforces team and the contest team. I was recently plagarised for my solution of problem C. I want to say that this is purely unintentional and i didn't take any help from anyone and solved the problem on my own. My solution id is 372850530 and it matched to a lot of solutions more likely a similar concept in solving rather than cheating. I hope the codeforces team will look into the matter. I am adding my brief approach.

So the whole point of the problem is trying to max out the MEX of an array using modulo operations. When I was dry-running the math, the main moment was realising how the modulo actually restricts us. Basically, if you want to turn some number x into a target y, you only have two options: either it's already exactly y (and you just take a massive mod so it doesn't change), or you gotta shrink it down. If you are shrinking it, the math works out so that you absolutely need x >= 2y + 1. That single condition basically carried my entire logic.

Ngl, my first instinct was just to code a greedy approach from the bottom up, trying to secure 0, 1, 2, and so on. But I ended up getting a WA on one of the test cases. When I debugged it, I realised my code was acting way too greedy. Like, to form a 0, it would just snatch up a 2 because it fit the formula. But that 2 was literally the only exact match I had for the target 2 later on, so I totally griefed my own sequence and cut it short. To fix this, I completely pivoted to binary searching the answer. By guessing a target MEX, I instantly know exactly which numbers I need to hoard. So the final logic is: lock down the exact matches first so they don't get wasted, dump all the leftovers and duplicates into a "spare pool," and then just pair the remaining missing targets with spares that fit the x >= 2y + 1 vibe. Since I sort the array right at the start, the checking function runs in linear time, making the whole thing a super clean O(N log N).

»
7 дней назад, скрыть # |
Rev. 4  
Проголосовать: нравится 0 Проголосовать: не нравится

hhh