henotrix's blog

By henotrix, 8 months ago, In English

Hello, Codeforces!

I am glad to invite you to take part in Codeforces Round 1045 (Div. 2), which will start on Aug/26/2025 17:35 (Moscow time).

You will have $$$2$$$ hours to solve $$$6$$$ problems. The score distribution is listed below.

There will be at least one interactive problem, so make sure to read the guide for interactive problems before the contest.

The round will be rated for participants whose rating is below $$$2100$$$, but higher rated users are also welcome to participate out of competition.

The problems were authored and prepared by me. I would like to thank:

Good luck & have fun!

UPD: Score distribution: $$$500 - 1250 - 1250 - 2000 - 2250 - 2750$$$.

UPD2: Editorial

UPD3: Congratulations to the winners!

Div. 1+2:

  1. Hamed_Ghaffari
  2. Otomachi_Una
  3. potato167
  4. Daniel_lele
  5. Rubikun

Div. 2:

  1. cly312
  2. polosatic
  3. Gheal
  4. Transformer911
  5. Timur_Kotlyarov228
  • Vote: I like it
  • +328
  • Vote: I do not like it

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

As a tester, I think the whole problemset is awesome! orz to author for making so much interesting problems!

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

As a tester, detset I.

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

As a tester, interesting problems and a really good contest.

»
8 months ago, hide # |
 
Vote: I like it -69 Vote: I do not like it

As a participate, I think we need less interactive problems (5 in a Row!)

I like them btw but my rating doesnt

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

As a tester, the problemset is one of my most favourite one. Good luck, hope you would enjoy it.

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

It's so strange that B and C got the same score of 1250.

»
8 months ago, hide # |
 
Vote: I like it -15 Vote: I do not like it

Speedforces?

»
8 months ago, hide # |
 
Vote: I like it -20 Vote: I do not like it

As a participant, i hate interactive problems.

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

Good luck!! :)

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

I think that interactive problems are overhated

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

.

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

Practicing interactive problems would be beneficial, especially given the performance in the last two contests.

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

I think, Contest will be math related. Because author is from China.

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

The score distribution seems interesting

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

I prefer interactive questions, which are more interesting than regular questions and relatively easy to add points

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

Is there any proper approach for interactive problems

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

why interactive problem why

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

this is my first contest,I'm so xcited!

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

As a tester, I like this problemset.

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

big jump? 500 to 1250?

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

"Atleast" one interactive problem which means B1 and B2 are interactive.

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

When was the last time problem B was an interactive problem in a Div2?

»
8 months ago, hide # |
Rev. 3  
Vote: I like it -20 Vote: I do not like it

so hard problem as beginner

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

Are problems B and C hard or medium? What is the prediction for today?

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

easier C looks like

nevermind, that was b1 and b2. C is indeed, harder than usual

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

    How and why do you think it's A B1 B2 instead of ABC?

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

      its a prediction and wouldn't be 100% accurate.

      but look at the scores.

      if it was C, it would be higher points than b no?

      so that makes me think there are 2 parts of B (although it could just be that B is interactive and that's why more points)

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

Holy Lord Jesus Mother of Speedforces!

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

Problem $$$B$$$ is actual cancer.

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

I want to submit a problem but I haven't registered :((

»
8 months ago, hide # |
 
Vote: I like it -57 Vote: I do not like it

If the writer's for the contest can't properly control the difficulty gradient of your questions, please refrain from setting problems and harm others. These rubbish rounds are wasting every participant's time!

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

    skill issue

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

      setters Brain issue.

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

      A reasonable level of differentiation is essential for a good tournament. It's not only grandmasters who deserve to compete; every participant should have the opportunity to compete at their appropriate level.

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

    It's very discouraging to see your rude words.

    First of all, you didn't even solve a single problem from the contest — how can you just call it "trash"? Do you know anything about the problem qualities? Authors, coordinators, and testers put endless efforts to make this round possible, but you are just staring at standings and send offensive comments. Aren't you too rude?

    Actually I found most problems enjoyable and interesting. The only issue is C being too easy — that's very hard to estimate difficulty for easy problems, so it is understandable for me. All the rest problems have nice difficulties. What are you complaining about?

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

      On one hand, although I didn't submit, I attempted all problems except F but only solved A, B, and C. On the other hand, even without solving any problems, the gap in pass rates between C and D clearly shows this is an unreasonable difficulty span (7000 to 400). The difficulty of C didn't deviate excessively from the norm, but D far exceeded the typical difficulty of a Div2D problem (it would be more reasonable to place it in the E).

    • »
      »
      »
      8 months ago, hide # ^ |
      Rev. 2  
      Vote: I like it -40 Vote: I do not like it

      i'd be moved by your words if this contest wasn't this much garbage

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

      I agree that he was way too rude. However:

      All the rest problems have nice difficulties. What are you complaining about?

      You could get green performance to yellow performance by just doing ABC. At this point what is the contest actually testing? I think DEF were master+ level problems and it sucks that they were the only other problems in this problemset after C, because they are otherwise very interesting.

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

    I'd argue the problems are really good despite the round being horribly unbalanced. Tbh rounds like this have been a problem since I've been blue and it really sucks that otherwise good problemsetters forget that the contests are made with a target audience in mind. A div2 contest should differentiate between cyans, blues and purples, not put everyone at 3 problems.

    • »
      »
      »
      8 months ago, hide # ^ |
      Rev. 3  
      Vote: I like it +17 Vote: I do not like it

      Have you heard of pigeonhole principle?

      You're either

      1. suggesting to increase number of problems, or
      2. asking authors to somehow make accurate predictions of solve counts

      both of which sounds incredibly stupid, especially when solve count ratio doesn't even look bad in the first place.

      Furthermore, why does having same number of solve count matter when ranking is based on sum of scores instead of solve count?

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

        I'm suggesting that div2 contests have problems that focus on differentiating div2 participants. I don't think it's crazy to say that it is expected of an expert to do ABC as much as it is expected of a green to do ABC. My point is that it doesnt make sense for DEF to be on the same div2 contest. They would individually be good problems on different div2 rounds. I do not believe you need to be particularly accurate to notice there is a big gap between C and D.

        solve count ratio doesn't even look bad in the first place.

        C has 20x more solves than D. This is pretty significant since this difficulty range of most div2 participants.

        Have you heard of pigeonhole principle?

        If you have 3/4 problems that div2 are expected to solve and 5 div2 ranks, you are practically guaranteed to run into a speedforce situation. In this case it was particularly bad because 2/3 of these problems fell under the same pigeonhole.

        Maybe you could argue that the only problem was that C was easier than expected, and otherwise the difficulty curve would be reasonable. However, it is expected that they would make the problem too easy, since there were only expert+ testers, and they are expected to do C every time.

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

          My point is that it doesnt make sense for DEF to be on the same div2 contest. They would individually be good problems on different div2 rounds. I do not believe you need to be particularly accurate to notice there is a big gap between C and D.

          C has 20x more solves than D. This is pretty significant since this difficulty range of most div2 participants.

          You have a fundamental misunderstanding of problem difficulty. It's not a fixed number assigned to each problem. For today's D, this 20x number could easily fluctuate to 5x depending on whether there was an easy diameter-related problem on some recent round.

          It's very hard to make sense of your argument when it revolves entirely around final solve count, which is not a number that is available to authors.

          If you have 3/4 problems that div2 are expected to solve and 5 div2 ranks, you are practically guaranteed to run into a speedforce situation.

          "speedforce" is a word invented for the purpose of some people getting validated on codeforces comment section. Speed matters on every contests regardless of difficulty distribution as long as the contest has finite duration.

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

    Hi, I'm not sure if it's too difficult for rated participants. I just came here to state some of the facts.

    • No author means to set extremely hard problems for Div 2. Div 1's are worth much more money. And, of course, we have no fun when seeing contestants suffering.
    • We had an army of testers. Nobody complained that it's hard for this position. Well, I might be biased, but I don't think everybody was.
    • If you are interested in improving the difficulty gradients of Div 2 contests, you are welcome to test the upcoming rounds and share your friendly feedback, instead of ranting under every announcement. Ranting doesn't make things better.
    • »
      »
      »
      8 months ago, hide # ^ |
      Rev. 2  
      Vote: I like it +10 Vote: I do not like it

      We had an army of testers. Nobody complained that it's hard

      • There's only 4-5 regular div2 rated testers though...
      • And not all testers might actually care in those details about the quality of a contest.
      • Moreover, friends of a problem-setter probably have similar problem solving approaches and thinking.

      I only meant to say just counting the number of testers for a round can't be enough reason.

      Anyway thanks for the contest.

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

    Hi, thank you for the comment. Trust me, it is also heart-breaking for me to see the results doesn't match my expectations.

    As for the gap between C and D, I think I made a mistake here. Originally the problem only asks for the minimum number of operations, which doesn't raise any suspicion that it might be too hard from the testing results. A few days before the contest we added the first operation output to prevent it from being too guessable (also some testers think that it is too easy for its place). I thought the difficulty would be the same, but after the modification, there are few Div.2 testers tested the round. Now I learn that problem modifications can be really tricky, and we should value Div.2 users opinion more :(

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

500−1250−1000−2000−2250−2750

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

I am quitting cp now, no more

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

Great D

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

the worst contest ever

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

codeforces round look inside speedforces round

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

someone tell me what was the logic for c about time i quit cp

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

    Greedy! For each even index element the prev element less than or equal to it. Now try to figure out how much you need to reduce the next element to satisfy prev + next <= current.

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

      for c not b

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

        My bad. I have edited the comment

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

        solve windows of length 2 (just lower the odd index to match the even one).

        Then solve windows of length 3 starting at an odd index. I chose to go on windows in increasing index, but prefering to decrease the higher odd index, so maybe i'll use less moves on the next window.

        All other bigger windows should be a sum of solved windows

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

    in 0-based we need to ensure

    for(int i = 1; i < n; i += 2){  
        if(i + 1 < n and a[i] < a[i - 1] + a[i + 1]) ...
        else if(a[i] < a[i - 1]) ...
    }  
    

    just check every elements at even indices, if it is smaller than the neighbour elements, then decrease the neighbour elements. We should decrease the a[i + 1] fisrt

  • »
    »
    8 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it
    • Look at subarrays of length 3.
    • You will realize the condition is $$$a_i \gt = a_{i + 1} + a_{i - 1}$$$ for even $$$i$$$.
    • Now we have to satisfy this condition for every even $$$i$$$. To do that, you can iterate over every even $$$i$$$ and see how much we can subtract from $$$a_{i + 1}$$$ (if it exists) so that it benefits both $$$a_i$$$ and $$$a_{i + 2}$$$, and then subtract the remaining necessary amount from $$$a_{i + 1}$$$ or $$$a_{i - 1}$$$ to satisfy the condition for $$$a_i$$$.
»
8 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can anyone tell why this is giving wrong answer https://mirror.codeforces.com/contest/2134/submission/335699285 It works on my VSCode :(

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

Is there any specific technique to solve D, or is it observation based only??

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

    The tree is a path graph if and only if the length of the longest path is n-1 (counting length as number of edges). Each operation can only increase the length of the path by at most one. I claim that you can always increase it by one. Find an operation that does just that.

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

      it doesnt increase only by 1. if the graph is a-b-c and b has another subtree that is a path of length x. doing the operation a b c will increase the length by x as it will append the path to c;

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

        It increases the longest path by 1. In your example the longest path wouldn't be a-b-c it would've been a-b->path from b of length x.

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

how to solve E

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

    find values from right to left, consider the parity of length of segment of twos after your position

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

Who felt that question C was easier than question B?

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

Is D something like: find the vertex with the longest chain going out of it (chain -> path connected to the vertex with no other vertices connected to that path) and let it be our c, and let our a be the vertex going into that chain from c

Additionally we need to consider a special case when there is only 1 vertex with number of children > 2

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

The problem was standered enough.

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

As a contestant i really enjoyed the problems though i could solve only 3

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

it was fun being purple again for two days i guess

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

did brute force problem B TLE on pretest 4 :(

I am not sure whether my approach was right or wrong anyways this was one hell of a round, at this point I think how will I become pupil

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

Problem difficulty goes from PUPIL to MASTER , what's the point of these half-baked rounds,wait for one or more intermediate problem and make a proper round.

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

Guessforces. And great gap between C and D.

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

Problem $$$C$$$: 8.9k

Problem $$$D$$$: 493 lmaooooo

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

What the hell was B & how did 10k+ solved that question?

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

    kinda spent more time thinking for B than C... saw C quite quickly ( if I am right )

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

    It was easy

    When k is odd -> You have to just add k once to all odd values, and the gcd of overall array will be 2

    When k is even -> Just add k to a[i], (a[i])%(k + 1) times, the overall gcd will become k + 1.

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

      How did you came to the solution when k is even?

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

        Let's consider ai = 5, k = 2. If you add 2 two times, 5 will become a multiple of 3. Take any odd number and k = 2, either you will add 2 to it one time, then it will become a multiple of 3, or two times. In case of ai = 7, just add 2 once, and 9 is multiple of 3.

        Try to generalize the idea, that we can make a number mulitple of k + 1 by adding k at most k times.

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

        if you add k to a , (a % (k+1)) times, it becomes

        n(k+1) + r + r*k -> (k+1)(n+r)

        so (k+1) becomes a factor

      • »
        »
        »
        »
        8 months ago, hide # ^ |
        Rev. 3  
        Vote: I like it 0 Vote: I do not like it

        Let g be the final gcd of A, we must add 0 or multiple k to make A[i] divisible by g. In other word, let r = A[i] % g, c = number of k adding to A[i], for every A[i], we should guarantee that there exists a c >= 0 where (A[i] + c * k) % g == 0. This actually means every number within [0, g — 1] should be achievable by this g which implies gcd(k, g) == 1. You can find this g by brute force in just few iterations. You can see k + 1 mentioned by other people is just a special case since gcd(k, k + 1) == 1.

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

    It's a bit easier if you first think about how you would solve it for k = 1; Obviously the best way is to make every element even. Then, you can try to solve the case k = 2, and even though you can no longer change the parity and make elements divisible by 2, you can note that it is possible to change the remainder when dividing by 3, and thus make every element divisible by 3. From there, you can generalize to all values of k, where for each k, you make every element divisible by k+1.

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

someone please tell me D was NOT re-rooting DP .. because then I will know I was not on right path and I will not cry :(

BTW <500 AC for div2D ... SPEEEDFORCESSS...

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

Please keep some pupils and specialists as testers from next time

How to solve B?

i guessed the solution, i dont even know will it pass the system test or not!!

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

the div2 problem B is tooooo hard TwT

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

As a newbie apart from A I couldn't solve any other question :(

Ps: Got 4 wrong answers.

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

I could only figure out a solution to E that uses $$$\frac{3n}{2}$$$ queries on average, but I couldn't find a worst case $$$\frac{3n}{2}$$$ query solution :(

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

Cool E! I really enjoy it.

My Solution

AC code

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

As a newbie,I want to ask for help:How D?Thx.

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

problem difficulty

A — 1

B — 2.9

C — 3

D — TREE(3)

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

nice round, i tend to think that D is harder than E

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

Nevertheless, the quality of the questions in this competition is very high!

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

Was D

spoil?
  • »
    »
    8 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it 0 Vote: I do not like it

    I think is not correct ... because imagine .. a very long chain.. ( so this chain will be diameter) ... no if we add another edge to any node near center... we will not slide that edge towards end of diameter but one portion of diameter over that edge

    like imagine 0-1-2......50....99-100 .. now if we have 50-101 as well

    we will not slide 50-101 to either side that will take 50 moves.. but we can slide one part of diameter over 50-101 edge

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

    I also thought of the same. But how can we decide to which side to shift each of the hanging trees to? Because once we shift a hanging tree to one side the diameter increases, and now the closer side to some of the hanging trees will also change.

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

    no, consider 1 6 1 2 2 3 3 4 4 5 3 6

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

      Im not sure how to read this

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

        Tree that has three chains from node 3, two of length 2 and one of length 1. The optimal operation is moving one of the 2 length chains to the end of the 1 length. The diameter would be 3 plus the 2 length chains.

  • »
    »
    8 months ago, hide # ^ |
    Rev. 3  
    Vote: I like it 0 Vote: I do not like it

    I thought "find the diameter" then slide part of the diameter onto the node not in the diameter.

    This gave me runtime error on test 7 (maybe it was bad implementation, as i didn't find a counterexample to this solution, i'm not sure)

    Edit:I just read the editorial, definitely bad implementation

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

How in C just checking subarray of size 2 and 3 is enough.

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

    Just consider the length of 3, and make a special judgment for length 2 when n=2.

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

    Let's consider the array is a1, a2, a3, till an

    If a2 >= a1 + a3 and a4 >= a3 + a5. Now if you take array of two size let's say a1 and a2, then we already made a2 >= a1 + a3, and the minimum value of a3 can be zero, so overall a1 will be greater than a2. Now if you consider 3 size array, then a2 >= a1 + a3. If you consider 4 size array let's say a1,a2,a3,a4. Here a2 >= a1 + a3 and a4 >= a3, so a2 + a4 >= a1 + a3.

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

B>A>C First time had a lot of time to spend on D but still couldnt solve.

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

[problem:D] 6 4 3 3 5 3 1 1 2 3 6 the NOTE given tree is right?

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

i want atto round 2 with Hamed_Ghaffari

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

hard D boring E

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

3 solved people range is too wide, but regardless of it, i enjoyed round thx :)

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

good contest :) but it will be better if the writer swap(problem D, problem E)...

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

What was the reason for the unusual output format in problem D? I can understand not forcing us to write the full sequence of operations because the implementation would be quite annoying and the fact that the number of operations is O(n) somewhat spoils the solution, but I don't see why the output couldn't just be the minimum number of operations required. Is it really because the answer being

Spoiler

would be too easy to guess?

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

    Double on that, at least it could have included both the minima and the operation too.

    That just makes people think on some random operation that might be part of the solution not thinking on the actual problem, idk how such simple thing passes over coordinators and so many testers.

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

WA1 sent vs judged difference is probably too big.

Sent 2025-08-26 17:50:26

Judged 2025-08-26 17:54:32

https://mirror.codeforces.com/contest/2134/submission/335630967

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

what would you rate the difficulty of problem B? 1200? 1300? 1400?

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

Can someone explain why this weird solution passes for B?

trying to make it work for primes under 100

335688760

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

    Similar code here only primes <= 29 needed to be precise. The idea is that you just need to find a prime number that does not divide k, so that you can keep increasing each number by k until the number becomes divisible by the prime chosen. Update: It seems any coprime number with k instead of a prime will work as well.

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

Great contest, thanks!

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

can anyone tell me in problem B when the K is even and let there is some odd numbers in the elements of the array then how do we execute in this case means how do we know that at a particular we have gcd > 1 , if we do we brute force we get TLE so how do we do that anyone plz tell ?

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

    if you add k to a , (a % (k+1)) times, it becomes

    n(k+1) + r + r*k -> (k+1)(n+r)

    so (k+1) becomes a factor

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

      bro can u tell me this in easy form means i not able to understand this man...

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

        You want all numbers to be a multiple of (k + 1). It can be achieved with at most k additions of k for any number.

        Let k = 9 and a number in the array is 29. 29 % 10 is 9. so you need to add k 9 times. 29 + 9*9 is 110 — a multiple of (k+1)

        For 28, we add 8*9=72, getting 100 — a multiple of 10 again

      • »
        »
        »
        »
        8 months ago, hide # ^ |
        Rev. 2  
        Vote: I like it 0 Vote: I do not like it
        x = a+k⋅(a mod(k+1)) is always divisible by k+1
        by division rule a = q(k+1) + r , 0<=r<=k
        and r = a mod k+1
        
        so,
             x   = a + kr
                 = q(k+1)  +r + kr 
                 = q(k+1) + r(k+1)
                 = (q+r) (k+1)
        

        so x is always divisible by k+1... do this for every number.. every number becomes divisible by k+1

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

          what was the intuition behind multiplying k with a%(k+1) I mean what did you observe to come to this conclusion?

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

            I couldn't solve the problem.. I saw his comment and just explained it to him why it works.. in contest I was able to reach one observation that a + a * k makes all the number divisible by k+1 .. but for that we need to add k a times.. but a can be greater than k so that goes out of the constraint.. I was stuck there.. so yeah I just explained to him why it works.. sorry for the rant

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

Need to ban:

akm19117012

RustyQuantPP

skebeb

ssnaik

Dudududududududud

TejasBharadwaj

humble.fool

for problem F, and it is only first page and I am lazy(sorry)

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

loved that D problem. The solution is incredible even though i miserably failed finding it!! (as always)

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

I was pretty please with my solution for B.

The easy ones: If n==1 just add k (to not have to check a>1), and if k is odd then just make all even.

If k is even, I determined that the smallest prime p that was not a factor of k would become a factor of all a when adding k zero or more times. Then just add k until k mod p == 0.

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

C was easier than B.. I wasted all my time on B did not even look at C.. so pathetic.. how can I avoid doing this in future? I mean can't just go through all the problems to determine which one should I solve..

should I read all the problems with same score then decide which one I want to solve first..

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

    If more than one problems have same score then you should definitely switch after a couple of minutes

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

Can someone help with the last step of C?

  1. I get that each even number must be at least the sum of its two direct odd neighbors.
  2. I also get that each odd number can be at most as high as their lowest even neighbor.
  3. It would be better to decrease an odd index where both its even neighbors benefit from decreasing it.
  4. I assume we have to use DP, since we are looking for a minimum.

But then I am stuck...

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

    You can solve the problem using just this fact: Every even number must be at least the sum of its two neighbors.

    First, lets solve the problem for the first number at an even index: $$$a[2]$$$. Notice that its always better to subtract from $$$a[3]$$$ first as that will affect $$$a[4]$$$, meanwhile subtracting from $$$a[1]$$$ won't affect $$$a[4]$$$. Now notice that when we move on to the next even number, $$$a[2]$$$ is satisfied. So again its better to subtract from $$$a[5]$$$ first.

    In general, it is always better to subtract from $$$a[i+1]$$$ (where $$$i$$$ is even) before you subtract from $$$a[i-1]$$$.

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

In problem D, I am getting "wrong answer given tree is not a path graph, but -1 found (test case 5)" for test case 2(truncated)

5447
1
2
1 2
3
3 2
1 3
4
4 1
2 1
2 3
4
4 3
3 2
3 1
5
3 4
1 3
5 2
1 2

But 5th test case which is the last one here, it is a path graph right? As per their definition written on the problem statement.

"A path graph is a tree where every vertex has a degree of at most 2 . Note that a graph with only 1 vertex and no edges is also a path graph."

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

As a newbie, I am crying.

But I will get better!

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

Good Round

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

"Sometimes the issue is not taking something as an issue…" I was considering a case but didn’t realize it was the corner case missing from my test data! Finally, I’m happy to score 3 problems, Siuuu… #CodeForces

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

Lucky Contest.

To get exactly 1400 with +17 and become a specialist !!!

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

I don’t understand such hate for problem D. If you look from afar, it is obvious that the diameter of the graph should be included in your final bambuk. And since there is no longer route than the diameter, we should move points that are not in the diameter. It was my first thought after I read the problem.

So I agree with henotrix that just answering n-1-diameter would be kind of guessable. Yes, it might look a bit strange that the output is the first move, but for problem D, just giving the minimum number would be trivially easy and not really appropriate.

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

I am struggling in solving B. I am not able build any intuition can anyone help how they solved it. Please

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

    You can make all the elements of vector divisible by (k + 1) by changing their value to x + k * (x % (k + 1)) where x is an element of vector. Do this for each element and gcd has to be atleast k + 1

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

      Yes i understood the solution using K+1 but how to get the idea during contest. i am feeling helpless from yesterday as i think if i had not seen the K+1 solution i would ever come to the conclusion. How did u get that idea???

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

        you need not do it with (k + 1) only you can do it with any number co-prime with k (k + 1 comes to mind the earliest as it is guaranteed coprime with k). After selecting a number you just have think mathematically what multiple of k has to be added for each element to make it divisible by your selected number.

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

        and about the intuition, If you get odd k, you can make all elements divisible by 2. If you get k = 2, you can make all elements divisible by 3. thinking a bit more you can figure out the formula

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

It's funny to see how the difference between top 600 and top 7000 is only the speed ppl do the first 3 problems

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

    yea there was a rating gap between 3rd and 4th problem, but generally if you go lower you will find more with same number of problems

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

I don’t know why it took so long to get the verdict on problem B. It showed 'Pretests passed' about 3 minutes after I submitted the code. Also, due to the Cloudflare verification after submission, I had to resubmit the code. Please try to fix these issues.

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

Hello, my submissions in this contest were skipped.
I understand that problem C was flagged because I referred to a friend’s solution when I got stuck.
I now realize this was a mistake and against the Codeforces rules.

However, problems A and B were entirely my own work, and I kindly request if it is possible to restore them.
I sincerely apologize for the violation and assure you it will not happen again.

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

Hello, My solution for Problem C ("Even Larger") was skipped for plagiarism detection. However, I want to clarify that I wrote the code myself by following the intended greedy approach described in the official editorial:

As explained in the editorial , only subarrays of length 2 and 3 need to be considered.

The correct solution is to use a greedy algorithm that decreases elements minimally so that the condition holds.

My code implements exactly this approach: at each step, I compute the minimal possible value to subtract (mini), ensure constraints for length-2 and length-3 subarrays, and carry forward a state (prev) to enforce correctness.

Therefore, my solution matches the standard editorial method, not any copied code. I kindly request that my submission be reviewed again. problem code link (335665812)

Thank you.

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

Subject: Appeal Regarding Plagiarism Flag

Hello Codeforces Team,

I hope you are doing well. One of my recent submissions was flagged as plagiarism, but I want to clarify that I did not copy from anyone or from the editorial. The code I wrote was my own, though I understand that sometimes solutions to these problems can naturally look very similar.

Problem C — My Submission — In my code, I loop only over even indices. For each v[i], I compute a value x which is the minimum possible value respecting two conditions: (1) it cannot exceed the min of its current pair (v[i], v[i+1]), and (2) it cannot exceed the leftover capacity from the previous pair (v[i-1] — p). I then accumulate the difference c — x into the answer. This shows I structured my logic independently, based on pairing and leftover constraints, not by copying.

https://mirror.codeforces.com/contest/2134/submission/335647244

I respect Codeforces rules and the community very much, and I would never intentionally break them. If my code resembled someone else’s, it must have been a coincidence because we solved the problem in a similar way.

I kindly request you to review my case. I am committed to ensuring that my future submissions reflect my own work clearly and will make extra effort to avoid any misunderstandings.

Thank you very much for your time and for maintaining the fairness of Codeforces.

Best regards, V_Prabath

MikeMirzayanov

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

Regarding the plagiarism flag on my submissions 335666797 (2134B) and 335670581 (2134C) of Codeforces Round 1045 (Div. 2)

Hello,

I recently received a plagiarism notice regarding my submissions for problems 2134B and 2134C. I would like to clarify that I wrote both solutions myself, but I understand how similarities with other submissions may have appeared.

During the contest, I faced network issues and could not reliably access my usual personal template/boilerplate. To save time, I used a very generic template on an online editor and simple variable names (like a and b). This may have made my code structure look similar to others who used the same approach.

For Problem 2134C:

  • I looped over the array at even indices.
  • For each arr[i], I computed a chosen value subject to two constraints:
  • It cannot exceed the minimum of the current pair (arr[i], arr[i+1]).
  • It cannot exceed the leftover capacity from the previous pair (arr[i-1] – prev).
  • I added (arr[i] – chosen) to the answer and updated prev = chosen.

For Problem 2134B: - I set target = multiplier + 1 and found its smallest prime factor.

  • I computed u = multiplier mod smallestFactor and its modular inverse v.

  • For each element of the array:

  • Reduced it modulo smallestFactor.
  • Computed the adjustment needed to make it divisible.
  • Used the modular inverse to calculate the multiplier.
  • Updated the element as numbers[i] += m * multiplier.

These were the independent logical approaches I used, though the overall structure might have coincided with other users.

I want to emphasize that this was not intentional copying. It was an unfortunate coincidence caused by my use of a common setup. In the future, I will strictly rely on my personal boilerplate and avoid generic templates or online editors to prevent such misunderstandings.

This is the first time I have ever received such a notice. I have never engaged in cheating, and I respect the rules and principles of competitive programming. I assure you that there will not be any behavior from my side that could be seen as unfair play. I am committed to competing honestly.

I sincerely request you to review my case with this in mind. Thank you for your understanding.

Best regards, swastik_2005

MikeMirzayanov

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

Attention!

Your solution 335622185 for the problem 2134A significantly coincides with solutions MASTER_RAFAT/335621768, wwwglll/335622185. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://mirror.codeforces.com/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked.

First of all, I don't know this person, and the time between his code submission and mine was less than a minute. Secondly, this is a relatively simple problem, and having similar logic in the code is quite common. You can check all my submitted code—it was entirely written by me.