henotrix's blog

By henotrix, 13 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

| Write comment?
»
13 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!

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

As a tester, detset I.

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

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

»
13 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

»
13 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.

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

Speedforces?

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

As a participant, i hate interactive problems.

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

Good luck!! :)

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

I think that interactive problems are overhated

»
13 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.

»
13 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.

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

The score distribution seems interesting

»
13 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

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

Is there any proper approach for interactive problems

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

why interactive problem why

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

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

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

As a tester, I like this problemset.

»
13 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?

»
13 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?

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

Holy Lord Jesus Mother of Speedforces!

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

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

»
13 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 :((

»
13 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!

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

    skill issue

    • »
      »
      »
      13 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.

  • »
    »
    13 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?

    • »
      »
      »
      13 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).

    • »
      »
      »
      13 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

    • »
      »
      »
      13 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.

  • »
    »
    13 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.

    • »
      »
      »
      13 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?

      • »
        »
        »
        »
        13 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.

        • »
          »
          »
          »
          »
          13 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.

  • »
    »
    13 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.
    • »
      »
      »
      13 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.

  • »
    »
    13 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 :(

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

500−1250−1000−2000−2250−2750

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

I am quitting cp now, no more

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

Great D

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

the worst contest ever

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

codeforces round look inside speedforces round

»
13 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

  • »
    »
    13 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.

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

      for c not b

      • »
        »
        »
        »
        13 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

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

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

»
13 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??

  • »
    »
    13 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.

    • »
      »
      »
      13 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;

      • »
        »
        »
        »
        13 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.

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

how to solve E

  • »
    »
    13 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

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

Who felt that question C was easier than question B?

»
13 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

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

The problem was standered enough.

»
13 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

»
13 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

»
13 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.

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

Guessforces. And great gap between C and D.

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

Problem $$$C$$$: 8.9k

Problem $$$D$$$: 493 lmaooooo

»
13 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?

  • »
    »
    13 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 )

  • »
    »
    13 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.

    • »
      »
      »
      13 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?

      • »
        »
        »
        »
        13 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.

      • »
        »
        »
        »
        13 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.

  • »
    »
    13 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.

»
13 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...

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

the div2 problem B is tooooo hard TwT

»
13 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.

»
13 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 :(

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

Cool E! I really enjoy it.

My Solution

AC code

»
13 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.

»
13 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)

»
13 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

»
13 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!

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

.

  • »
    »
    13 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

  • »
    »
    13 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

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

      Im not sure how to read this

      • »
        »
        »
        »
        13 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.

  • »
    »
    13 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

»
13 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.

  • »
    »
    13 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.

  • »
    »
    13 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.

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

i want atto round 2 with Hamed_Ghaffari

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

hard D boring E

»
13 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 :)

»
13 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)...

»
13 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?

  • »
    »
    13 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.

»
13 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://codeforces.me/contest/2134/submission/335630967

»
13 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?

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

    ig, 1300 must be fine, it just requeires some basic number theory knowledge

»
13 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

  • »
    »
    13 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.

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

Great contest, thanks!

»
13 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)

»
13 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)

»
13 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..

  • »
    »
    13 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

»
13 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...

  • »
    »
    13 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]$$$.

»
13 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."

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

Good Round

»
13 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

»
13 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 !!!

»
13 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.

»
13 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

  • »
    »
    13 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

    • »
      »
      »
      13 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???

      • »
        »
        »
        »
        13 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.

      • »
        »
        »
        »
        13 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

»
13 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

  • »
    »
    13 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

»
13 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.

»
13 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.

»
12 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://codeforces.me/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.