ezraft's blog

By ezraft, 3 months ago, In English

Hello, Codeforces!

We are glad to announce that Codeforces Round 1108 (Div. 2) will take place on Jul/12/2026 17:35 (Moscow time). The round will be rated for participants with rating below $$$2100$$$. You will be offered $$$6$$$ problems, with $$$2$$$ hours and $$$15$$$ minutes to solve them. At least one problem will be interactive, so please make sure to read the guide for interactive problems before the contest.

The problemset was created and prepared by 0mar, countful, diss_quack, farmpiggie, lce4113, Whoname, and me. We are all members of the UCSB ICPC community.

Thank you to the following people who made the round possible:

We hope you will enjoy the round!

Left/Top: ezraft, Whoname, 0mar, lce4113, countful, diss_quack at the ICPC Southern California Regional.

Right/Bottom: diss_quack, ezraft, lce4113, farmpiggie at the ICPC North American Championship.

UPD: The scoring distribution is $$$500-750-1500-1750-2250-2750.$$$

UPD2: Editorial

  • Vote: I like it
  • +144
  • Vote: I do not like it

»
3 months ago, hide # |
 
Vote: I like it +22 Vote: I do not like it

oars sirs

»
3 months ago, hide # |
 
Vote: I like it +65 Vote: I do not like it

ok

»
3 months ago, hide # |
 
Vote: I like it +22 Vote: I do not like it

as a tester, make sure to smash that register button

»
3 months ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

woah

»
3 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

as a tester

»
3 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

As not a tester i hope i become pupil in this contest

»
3 months ago, hide # |
 
Vote: I like it +19 Vote: I do not like it

:)

»
2 months ago, hide # |
 
Vote: I like it +24 Vote: I do not like it

As a tester, front forget, back forget.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

At least one problem will be interactive

yes yes yes yse finally

»
2 months ago, hide # |
 
Vote: I like it +26 Vote: I do not like it

Finally an interactive problem....

Excited!

»
2 months ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

I LOVE YOU COUNTFUL! I LOVE YOU COUNTFUL! I LOVE YOU COUNTFUL! I LOVE YOU COUNTF

»
2 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

As a tester, UCSB is next to a beach

»
2 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

As a participant, .

»
2 months ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

my #99 rated contest! good luck every participant!

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I hope there will be 6 interactive problems

»
2 months ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

As a taster, countful gave me his burritos

»
2 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

oof, i read ucsb as usb-c somehow

»
2 months ago, hide # |
 
Vote: I like it -6 Vote: I do not like it

Has anyone tested the solvability of the problems using AI?

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hope i am able to solve till D or E . glhf

»
2 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Thanks for the round , Wishing everyone the best of luck

»
2 months ago, hide # |
 
Vote: I like it -17 Vote: I do not like it

.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

As a participant I hope to reach expert this round pls pls pls

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hello **everyone ** how are you all??

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

OK

»
2 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

ezraft lce4113 Thanks for organizing.

»
2 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Excited to see yg again at NAC next year

»
2 months ago, hide # |
 
Vote: I like it -6 Vote: I do not like it

As not a tester i hope i become candidate in this contest

»
2 months ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

First half of time: solved ABCD.

Second half of time: stared at the screen to see my rank dropping.

»
2 months ago, hide # |
 
Vote: I like it -14 Vote: I do not like it

I'm asking myself where did my comments go:

Before:
After:

PS: How can the author write the checker for A?

»
2 months ago, hide # |
 
Vote: I like it -9 Vote: I do not like it

hint for C.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

$$$C$$$ is a hard counting problem man. It's not very easy, coming up with the observation is hard, and implementing the counting carefully is also hard. How did 5k people manage to solve it?

Didn't really like $$$B$$$ too. Took too long to get that $$$1, 2, 3, sum,...$$$ pattern.

»
2 months ago, hide # |
 
Vote: I like it -7 Vote: I do not like it

Got humbled by C terribly :(

»
2 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Is there a deterministic solution for E?

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    What's the random solution. I've been thinking that since adaptive the grader can always defeat us

    • »
      »
      »
      2 months ago, hide # ^ |
       
      Vote: I like it -21 Vote: I do not like it

      Simply generate $$$m_0$$$, $$$m_1$$$ randomly will hopefully distinct $$$b$$$. $$$x$$$ may be relevant to $$$v$$$, but $$$m_0$$$, $$$m_1$$$ is not relevant to $$$v$$$ according to the description. Choose an $$$x$$$ with $$$15$$$ bits of $$$1$$$ and $$$15$$$ bits of $$$0$$$ will pass with a high probability, I think.

  • »
    »
    2 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it +11 Vote: I do not like it

    I think you can prove its not possible: if you query 0..{a times}1..{b times}. WLOG (u can reorder bits) , and you get the same number back, then no matter what two numbers X and Y u give they could return {first a bits of X}{last b bits of Y toggled}.

    • »
      »
      »
      2 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Thanks. I was thinking how to handle this corner case during the contest but failed, so I didn't submit any solution...

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    My E sol doesn't use any random element and passed, I might be missing some case though but don't see it for now.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Depends on exactly what you mean by deterministic.

    Is there one where you can just hardcode in values? Yes, you just take the probabilistic solution and do your rng() calls outside the code and then hard code it in. However, this makes it so a strong adversary has probability 1 of hacking your code; they can just check what your values for m0/m1 are to make your m0 look like m1 (or vice versa) and trick you into assuming the wrong one. Luckily, hacks are disabled on E so nobody can be said strong adversary.

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Problem A and B are like, if you're able to figure out the pattern, its cakewalk otherwise you keep staring at the screen for hours, no luck. I love mathematics.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

C is a great problem :-)

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I've submitted A twice (since I'm not sure that if the first submission is correct), if the first one is correct, will I get -50 for resubmitting?

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Its so hard :(

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

A huge thank you to the contest authors and testers for putting together such a fun and well-crafted Codeforces round! It's easy to forget how much thought, debugging, balancing, and testing goes on behind the scenes to make these contests enjoyable for everyone. I had a great time solving the problems, and I really appreciate all the hard work that made it possible. Looking forward to the next one!

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it
»
2 months ago, hide # |
 
Vote: I like it -14 Vote: I do not like it

Thanks for the contest, it was my favorite div2 in a while! I feel a bit bad for using an alt, but I felt like it'd make me a lot happier than basically never having the motivation to do another contest again, and this contest was definitely evidence for that.

For E
  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    you should feel bad since alt accounts are not even permitted if i remember correctly XD

    • »
      »
      »
      2 months ago, hide # ^ |
       
      Vote: I like it +3 Vote: I do not like it

      I'm aware of that but imo the main downside of alts is that they deflate rating and ruin standings/rankings. Since that's already happened a lot, I believe the negative utility incurred by my alt is much less than pre-AI, and worth just making myself happier :p

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can someone explain solution of c and d, I'm absolutely cooked

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it
    soln for C
  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    the initial -1s allow us to fudge with the target sum. if we take even-many -1s, then our target sum among regular numbers is 0. Otherwise our target among regular numbers is -1.

    • selecting odd-many regular numbers results in sum > 0: b1 + (b3-b2) + (b5-b4) .... This doesn't work for us.

    To obtain sum=0 with even-many regular numbers: consecutive selected pairs (b1,b2), (b3,b4)... have nonpositive sums. Hence resulting total sum is <=0 and is equal to 0 Only if each consecutive pair has equal elements. Then num_ways to obtain total=0 using even-many regular numbers is easy counting problem.

    To obtain sum=-1 with even-many regular numbers: similar case. code is easier than explaining:


    int n; cin >> n; int negones = 0; vii grps; for (int i = 0; i < n; i++) { int x; cin >> x; if (x == -1) { negones++; } else if (grps.empty() || grps.back().first != x) { grps.push_back({x, 1}); } else { grps.back().second++; } } ll z = 1; // num_ways to select total = 0 among regular numbers ll no = 0; // num_ways to select total = -1 among regular numbers ll ans = 0; for (auto [x, f] : grps) { z *= modpow(2,f-1); z %= MOD; } for (int i = 1;i<grps.size();i++){ if (grps[i].first == grps[i-1].first + 1) {no += z; no %= MOD;} // odd number from each of the two groups. this nets the same as even_from_all_grps } if (negones == 0) ans = z; else{ ll even_neg = modpow(2,negones -1); ll odd_neg = even_neg; ans = (z * even_neg)%MOD + (no * odd_neg)%MOD; ans %= MOD; } cout << ans << endl; }
»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hi all! Did someone try D?If yes please drop some hint.

»
2 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

in C to avoid tricky combinatorics you can just do knapsack dp with a map and only store sums which are <eps away from 0 and <eps away from the current number, where eps is some small integer (i have 10 in my code)

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

B is classical and too hard for the position.

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Somehow the queue is so good today

»
2 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Crazy Contest , It just Fu#k me

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I wrote the following code in E: 382296469

I have a few questions:

1) why does it work?

2) why does it stop working if K is increased (there are always two bad values ​​of v)?

3) how does the ``standard'' solution differ from mine?

Apparently, the probability of my solution getting an AC is many times lower than what the authors expected.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

for problem E, x=1 directly gives 'ty' and also the parity of 'v'. Tbh I wasnt even thinking to come close to intended solution. Solving other problems seemed kinda boring compared to this. The setters must have felt |cinema|.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

My solution is coinciding with one more contestant though I didn't share my code not i usw any platform to publicize my code also the contestant is unknown to me. This is a total coincidence of same solution.

»
2 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

I have been flagged for cheating on problem C. However, I did not cheat in any way. The message I received said my submission, 382266816 was found to be similar with cindu_1402/382277909, Kiruthika_10/382279819, Sarmi_18/382281148, Saha_.na/382282080, Boomi_07/382282494, bu_xiang_qu_ming/382285591, Dharsh_30/382288493, LioHein/382290058.

First of all, my submission only shares the same idea with LioHein's one, 382290058, while the others do exactly what is explained in the editorial (I overcomplicated things in my solution). Therefore, I believe that this excludes any accusation having to do with everyone but the last contestant listed above, LioHein.

Now, even though me and LioHein do basically the same thing, I must say that our codes are as different as two can be, while still doing conceptually the same thing (treat even and odd length cases separately, and when dealing with the odd length case, fix the values that are going to appear on odd number of times (besides -1), and we calculate the number of ways for each of these using some prefix and suffix precalculations). Not only do I precompute the powers of 2 while he uses fast exponentiation (i have fast exponentiation as a function in my code as a template but i do not use it), but he keeps an additional array with each unique value and its frequency and solves the problem on that array, which is smarter and easier than what I do (I just manually traverse each block of equal values each time I need to). I believe anyone could look at our 2 codes and say that nobody cheated. It was just a coincidence that we both did not see the easier solution explained in the editorial and came up with this.

Is there anything else I can do to prove my innocence? I actually did well in this contest and it would be a shame if I wouldn't receive rating for it (I will assume that if I get flagged for cheating the round doesn't count for me, I don't know for sure). Do you guys know anything else I can do, maybe I should contact someone else? I thought this would be the right place to write this message but maybe there is somewhere else better, idk.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Oh, this is the first time I've been mentioned in a comment. I just found out that an article accusing me of cheating was sent to my email. Now I know what "skip" means. But I'm probably not from the same country as the blogger, and I watched the solution. For a classification discussion question, isn't it normal to have a fixed discussion mode and approach? Thank you again for the blogger's mention, which made me notice this strange email, even though I didn't perform very well in that competition.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Problem C was interesting good job bros

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hello. I recently received an automatic plagiarism warning for my submission to Problem 2246D. I would like to request a manual review of my solution, as I solved the problem independently during the contest and did not copy or share my code with anyone. After comparing my solution, I do not believe it has significant similarity with the submissions mentioned in the warning. If the system has produced a false positive, I would sincerely appreciate a manual verification of my submission. Thank you for your time and consideration.