paulzrm's blog

By paulzrm, 10 months ago, In English

Hello Codeforces!

We are glad to invite you to participate in Codeforces Round 1068 (Div. 2) on Dec/05/2025 17:35 (Moscow time).

This round is rated for all participants with rating below 2100. You will be given 6 problems and 2 hours to solve them. At least one problem will be interactive, so please make sure to read the guide for interactive problems before the contest.

In this contest, characters from four different anime series appear in some of the problem statements (including the one my avatar is from). Can you guess which series they are?

We would like to thank:

The score distribution will be announced later.

Good Luck & Have Fun!

UPD1: Score Distribution: 500 — 1000 — 1250 — 1750 — 2250 — 3000.

UPD2: In this round, hacks will be disabled on problems A, B, C, D, and E. We will have pretests = systests in these problems. Hacks will be enabled on F as usual, and we will have systests = pretests + hacks.

UPD3: The editorial is out.

UPD4: Congrats to the winners!

Div. 1:

Div. 2:

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

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

house of red's!

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

Angel Beats!

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

As an author, hope you enjoy the round!

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

Angel Beats. The character is Kanade Tachibana, one of the best Kuudere there is

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

Good luck & Have fun!
ο(=•ω<=)ρ⌒☆

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

As a tester, I enjoyed the round.

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

As a tester, I solved all problems before the contest. I made a video. Don't miss it. It'll be published here.

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

    I feel like people think you're gonna publish it before the contest, which might be why you got downvoted. I clicked on the link and I think that you are actually a fairly good public speaker — I wasn't bored while I listened to the video on the homepage. But I think that you said that you're "not intelligent" too much. If you actually feel that way and you think mentioning it would add to your lecture, I think you should say it at most once.

    Anyway, you said that past the rating of $$$2500$$$, the only thing that matters is intelligence. Your reasoning was that everyone at that level is perfect in knowledge and implementation, so intelligence is the only thing that matters then. But the reverse of this is most likely true: intelligence matters more at the lower levels and less at the higher levels. This is because the general intelligence factor is less predictive of skills, abilities, test scores in higher skilled/higher ability populations.

    This is known as Spearman's law of diminishing returns, and it applies to $$$IQ$$$ tests themselves, as $$$IQ$$$ tests aren't perfect measures of intelligence (so someone who scored, say, $$$130$$$ on a test is more likely to be further away from their score in terms of "actual intelligence" than someone who scored $$$100$$$). But just because intelligence doesn't play as big of a role at that rating doesn't mean that mutable factors make up for it. So this doesn't necessarily mean that it's easier to change your rating at $$$2500$$$ than at $$$1500$$$, all else being equal.

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

      He is well known for arpa's trick .

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

      Ok. Why not ask who mentioned this first time to defend his idea?

      you said that past the rating of 2500, the only thing that matters is intelligence

      -is-this-fft-, can you please jump in?

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

        Yes, I said something like that. To clarify, I like to break down competitive programming skills as:

        • implementation: the ability to express your ideas in code swiftly and accurately;
        • theory: knowledge ofb algorithms and mathematics;
        • "thinking skills": the ability to reason, generalize and apply the others.

        (There is a fourth, contest strategy, but let's leave that out for now). I should note that this is not a clean classification, the skills are certainly intertwined; for example, probably a big part of "thinking skills" is experience, and some might classify parts of that as "theory".

        And I do think that implementation and theory have very heavy diminishing returns: there comes a point where you can effortlessly implement pretty much anything relevant for competitive programming, and a point where the algorithms you do not know are very obscure things that have only ever appeared in one or two problems. The reason I bring this classification up is usually to illustrate how learning algorithms from books and blogs can only get you so far, and most of the work has to be solving problems.

        I don't completely understand what 123gjweq2 is trying to say, but I do think there is some amount of talking past each other going on here. Because "thinking skills" in this context certainly does not equal "general intelligence"! It is very much specific to competitive programming.

        I try to avoid using the word "intelligence" altogether because it is so vague and has so many different meanings. Arpa did use that word, but he talks about improving it by practicing AtCoder and JOI in the very next sentence. From that context it should be blatantly obvious to anyone that he is not talking about "general intellgence" either.

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

          Basically, what I was trying to say is that, because of Spearman's law of diminishing returns (higher-skilled persons rely less on their general ability (g) to solve tasks), general intelligence most likely plays less of a role in the skill of higher-rated users than it does in the skill of lower-rated users.

          I think that you have a pretty good breakdown of competitive programming skill, and I'm not exactly sure how it is at 2500+ rating, but from what I've seen, "thinking skills" matter more in solving those problems than any sort of knowledge or implementation skills. So I actually agree with you. And it is true that competitive programming "thinking skills" or "problem-solving skills" are not close to the same thing as general intelligence, but they are definitely influenced by general intelligence.

          Arpa did use that word, but he talks about improving it by practicing AtCoder and JOI in the very next sentence.

          I guess that my problem is that it wasn't exactly clear what he meant by intelligence. Cuz somewhere in the video, he said something along the lines of "if you're intelligent, thank your parents" which would suggest that he was referring to something closer to general intelligence (which is largely heritable and can't really be improved) than codeforces thinking skills, which can definitely be improved to an extent.

          I think the only way he could be consistent in his usage of intelligence is if he believes that one's baseline intelligence comes from their parents, but they can (possibly significantly) improve it by solving a lot of codeforces problems.

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

            This is a really good thread, under an unrelated post. I'm really fixing and sharpening my ideas here.

            I think I was using intelligence in two different meanings. When I said, "Past the rating of 2500, the only thing that matters is intelligence," I meant thinking skills. When I said, "If you're intelligent, thank your parents," I meant general intelligence.

            By the way, how does general intelligence affect thinking skills? This is still an open problem for me. Do people with higher general intelligence grow faster in thinking skills (slope), or are they better at the beginning, but they lose their advantage when they grow (Y-intercept)?

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

              I also think that it's a good thread.

              By the way, how does general intelligence affect thinking skills?

              Well that's a very hard question, and I don't think anyone knows the answer, at least for codeforces thinking skill. There are surprisingly few studies on $$$IQ$$$ vs competitive math/programming skill.

              First of all, most people don't know the definition of general intelligence, so just so we're on the same page, I will say it here. The general intelligence factor (or g factor) is basically a statistical factor (or underlying variable that can't be measured) that explains why some people will, on average, do better than others on pretty much every cognitive test in existence.

              Like if you give someone a language test and they do really well on it, you'd expect them to do well on a math test too, even though, on the surface, there really isn't much in common between the language test and the math test. If you give someone a reaction time test and they do well (say, over-average) on it, well you can say that they are more likely than not to do well on pretty much every other mental test out there. You can argue that maybe doing well on tests isn't exactly the same as being 'smart', but the factor that accounts for this is called general intelligence.

              Since codeforces can be considered a cognitive test, we can say that, given that two people know how to code but they don't have any competitive programming experience, the more intelligent one is more likely than not to do better than the less intelligent one. Okay, you probably could've figured that out by yourself. But, since general intelligence is so all-encompassing, this also applies to two people with the same amount of experience at any level of experience.

              It's also important to note that just because general intelligence plays less of a role in higher-skilled contestants doesn't mean it plays less of a role in contestants with more experience.

              I suspect that the skill gap between two people with differing $$$IQ$$$s widens rather than shrinks as the experience level goes up. Imagine someone who is like $$$70\,IQ$$$ — they might really have a tough time learning how to code, if they could learn at all. Their rating is basically gonna plateau very quickly at a really low level. Now imagine someone with $$$150+$$$ $$$IQ$$$ — they might reach $$$LGM$$$ with enough practice, but that would still take a lot of practice. The gap between the $$$70$$$-$$$IQ$$$er and the $$$150$$$-$$$IQ$$$er pretty much only increases, and I don't see why this would change for any pair of $$$IQ$$$ scores.

              Also, if one's rating (output) vs time spent (input) could be a function, it would more or less be an increasing function but with a decreasing derivative, maybe like $$$y = IQ \cdot \sqrt{x}$$$. This would mean that, not only is someone with higher $$$IQ$$$ and the same level of experience gonna do better than you, but as you gain more and more experience (and they do too) it will take more and more additional time for you to close the gap, if they were to just stop practicing. So, to answer your question, I would say both. I would be surprised if it weren't both.

              Since it's relevant, I'd like to also add this graph (scroll down a little bit to problems solved vs rating as a percentile) https://carnegiemellon.shorthandstories.com/competitive-programming-talent-vs-tenacity/index.html that kind of shows this widening, even with all of the interfering factors.

              Btw, you say you're of average intelligence, but why don't you actually find out for yourself? I would really appreciate it if you tried a few subtests from https://cognitivemetrics.com/test/CORE this test (ideally, Quantitative Knowledge, Arithmetic, Figure Weights, Antonyms, Information: all 5 of those would yield a pretty accurate estimate of general intelligence (the items are good, but I'm not so sure about the norms, but they seem alright), but to be fair since I'm assuming English is not your first language, antonyms might be deflated for you).

              You don't have to pay, unless the mods there made it so you actually have to pay now. I wouldn't be surprised if they did that, since some of them have done much worse things wrt scamming people. Everyone will eventually face judgement for what they have done. But the test seems alright. It will probably say you will have to pay but the charge will be $$$0.00$$$ and you just put in your email and get your score. Anyway, you don't have to take it but I think you should figure out if you are actually around $$$100\,IQ$$$ since you say it so much.

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

                Thanks for the valuable article you introduced. Also thanks for your explanations.

                I think I'm pretty agreed with what you said.

                By "I'm not intelligent", I mean "I'm not intelligent compared to my society". My society is Iranian OI folks.

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

      Sorry, I don’t know the context in which this is said, but please clarify how everyone at the level of 2500 is perfect in knowledge and implementation? That does not even begin to sound right to me

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

    Keep goin bro.! Your videos are great.!

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

    I will be fast from the next contest. I was very busy for this contest.

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

Too early for unhinged comments, see you guys later

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

As a novice, I hope to be able to solve three problems.

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

Hope to increase my rating:)

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

Score distribution??

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

As a tester,I think the problems in this round are very inspirational.

Hope you can enjoy this competition.

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

wowee anime !!

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

I hope I can learn something new after this contest.

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

i have been practising lots of cses in my spare since the last contest hopefully i can utilise my newer toolset this contest :)

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

As a tester, I cannot disclose whether there is anything related to my avatar.

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

let`s go!

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

I was 999 hoping to reach for the first time my 1000 rating unfortunetly, after the last div 2 i got -48 I wish Gl to everyone in this contest and hope i'll reach my goal of 1000 !

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

"Angel" from Angel beats?!? My favorite!

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

Angel beats! Also my avatar!

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

Lets see how this long break turns out for me >-<

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

Anime: Angel Beats

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

As a participant, I am very excited for this round. I hope I will learn something new.

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

That new disabling hacks might seem okay for new users, but I feel a bit selfish about it because they wouldn't know what we felt after getting "Hacked" in our best-performing round.

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

Finally interactive problems are back

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

The contest starts in 1 minutes. GLHF guys!

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

I found a test case could hack my first commit, and I think it would hack many others.

However, hacks will be disabled on problems A, B, C, D, and E. We will have pretests = systests in these problems.

I don't know this before. And I commit the second code for that problem to prevent hack. I had been reduced 50 score in vain. To sad!

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

    Sorry to hear that. You can try uphacks anyway :)

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

    Im pretty sure your first solution was correct too.

    The only difference i can see is checking whether k > a * n. But in that case in the first solution you find temp not in t after at most n iterations of your cycle, you dont continue up to temp = k. So it is fast enoght

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

      How about this case:

      200000 1000000000
      2 3 5 7 11 13 17 19 ...
      

      I think if each element go a complete loop that the total of cycles will be $$$4 \times 10 ^ {10}$$$, that will be TLE.

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

        Then immediately for a=2 temp=4 you print -1 and leave solve()

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

          Oh, I have known.

          The count of a complete loop is can't be over 30, so that the upper limit of the time is $$$6 \times 10 ^ {6}$$$, that's viable all right!

          Thanks for your explanation.

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

    Oh my god! Bacause of the resubmission, I failed to get Specialist shorted just 2 rating.

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

how is C having 4000+ submissions , even I am not getting it :( (big -ve coming)

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

only 2s for C ? funny

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

I personally didn't like the contest that much. The problems seemed too direct and didn't contain any aha moments or magical mathematical observations, which is what I personally like the most.

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

For me B>>C>>A

Couldn't look at D (thanks to B)

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

    bro B is just a simple greedy and dp

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

      what greedy .. like choose max / min from previous step you mean or some other greedy ?

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

        ye i mean that kinda of greedy,and the dp is straight

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

          What is the DP solution ?

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

            so what I did was like .. you have 2 choices at every pos .. choose from A or choose from B so you can combine these choice with answer from previous state

            but because we can negate the answer from previous state ie -k is possible we have to store min and max values from previous state .. so at every position we store

            • choose A/B and min/max for that
          • »
            »
            »
            »
            »
            »
            10 months ago, hide # ^ |
            ← Rev. 3  
            Vote: I like it +3 Vote: I do not like it

            DP solution :
            We can have a total of 4 possible states :

            $$$dp[i][0]$$$ = maximum score if we take A[i]
            $$$dp[i][1]$$$ = minimum score if we take A[i]
            $$$dp[i][2]$$$ = maximum score if we take B[i]
            $$$dp[i][3]$$$ = minimum score if we take B[i]

            Making transitions for these is quite straightforward. My Submission
            If anyone have a better solution with even lesser states, please share.

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

              just save two variables minimum and maximum score for prefix i and the transitions for this are also easy

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

              I practically did exactly that but I dont entirely get why the answer could be max(dp[n][0/1/2/3]) lol. I thought that it would be max(dp[n][0/2]), but it didnt work so I just changed that. But that makes me think the code would be vulnerable to hacks lol

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

      greedy and dp?

      you gotta choose one buddy

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

        well tbh it is not conflict,you have to find a good strategy(in my perspective it is greedy) to get the dp dormula

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

i solved 3 questions in div2 contest for first time!!!

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

Best problemset of 2025. $$$B$$$ was amazing. I really thought my solution on $$$C$$$ would TLE but it passed somehow. $$$D$$$ was also a really nice problem.

Thanks for the round paulzrm HHH666666 chen_zida HugeWide and all testers!

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

cannot believe my first ever div2-AK is due to the last problem being $$$O(q \sqrt{n} \log{n})$$$-able (unless system tests fuck me over that is)

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

    btw, to people struggling with fitting this solution into the TL: a simple optimization that cut my runtime in half is to just increase the lower bound of the block size that you binary search for, to the block size in the last iteration

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

    We have a solution with lower time complexity, however it is too difficult to make the qsqrt(n)logn solution get TLE while letting all solutions with our intended complexty pass, so we compromised :(

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

      if you intended to allow $$$O(q \sqrt{n} \log{n})$$$ solutions, the TL should probably have been even higher, because I think most implementations would initially be too slow to pass without some awkward optimizations.

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

        That's what we wanted. We have to let solutions with $$$O(q\sqrt(n\log n))$$$ with big constants pass and of course, do not want any $$$O(q\sqrt(n)\log n)$$$ to pass. Unfortunately this is impossible.

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

          Isn't the optimal complexity $$$O(q\sqrt{n})$$$?

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

            No, it's $$$O(q \sqrt{n \log n})$$$

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

              You can first check whether the binary-search range exceeds $$$O(\log^2 n)$$$. If it does, you only need to perform the search $$$O(\sqrt{n}/\log n)$$$ times; otherwise, each binary search costs only $$$O(\log\log n)$$$. Thus it is $$$O(q\sqrt{n}\log\log n)$$$. You can use some other techniques to achieve $$$O(q\sqrt{n})$$$

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

                Sorry, I didn't think that far for this problem. Maybe you're right, and another author points out that there exists an $$$O(q \sqrt{n})$$$ solution in the editorial. I mean we decide to let $$$O(q \sqrt{n \log n})$$$ pass regardless of whether or not it's optimal.

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

All was going good for me, and then I misread k could be 0 in D :<

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

as a contestant, i choked on problem A

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

    I made 1 WA coz didn't read the problem right I guess... but unluckily my solution passed the test case which were given lol

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

      In my opinion though, it would be better if they added an example when the two "awake" ranges intersect with each other, like if the student has to be awaken from class 1..3 then another at 2..5? That would be more clear.

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

Implementation for E sucks unless i have a wrong idea

my idea is similar to quick sort + divide and conquer

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

    I tried some stuff with cycles, my idea is that you should always try and swap parts of a cycle such that the mirror is also part of a cycle (maybe the same one). That way, regardless of what happens you can reduce the total length of cycles by 1. Then when you run out of those, whenever you make a swap, if it makes the mirror swap, you add it to a cycle so you can check to see if any pair satisfies the above. Made a really dumb mistake on the cycle logic with 2 minutes left, but we speedran C so we are still in the skibidi i think.

  • »
    »
    10 months ago, hide # ^ |
    ← Rev. 4  
    Vote: I like it 0 Vote: I do not like it

    The idea and implementation were both really simple.

    Solution sketch:

    • Denote the index of value $$$i$$$ in the current permutation with $$$q[i]$$$.
    • We will put elements $$$i$$$ and $$$(n - i + 1)$$$ at their correct positions in every round, going from $$$i = \lfloor(n/2)\rfloor$$$ to $$$i = 1$$$ (for odd $$$n$$$, just get the middle element to its position by trivially spamming queries first).
    • We first repeatedly query $$$(i, q[i])$$$ until $$$p[i] = i$$$. Note that this doesn't move any of elements placed at their correct positions in the previous rounds. The expected number of moves this requires is $$$1/2 + 2/4 + 3/8 + 4/16 + \dots \approx 2$$$.
    • Now, we have to put value $$$(n - i + 1)$$$ into $$$p[n - i + 1]$$$. What happens when we query indices ($$$n - i + 1, q[n - i + 1])$$$? Either indices $$$(n - i + 1, q[n - i + 1])$$$ get swapped, or $$$(i, p[i])$$$ get swapped. If the former happens, then we're done. What if the latter happens? We'll then have $$$q[i] = n - q[n - i + 1] + 1$$$. This is helpful because now we're guaranteed to fix at least one value by performing a query on $$$(i, q[i])$$$, and we're then back to the initial state, from where we can repeat this sequence of moves. The expected number of moves here is $$$(1/2 + 3/4 + 5/8 + 7/16 + \dots \approx 3$$$. Once again, none of these swaps disturb the values we fixed in the previous rounds.
    • We therefore fixed two values with an expectation of $$$2 + 3 = 5$$$ moves, which translates to an expectation of $$$2.5$$$ moves per value. This is obviously good enough for the query limit.

    Code: 352078041

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

      damn, i overcomplicated because it was problem E lol

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

      just getting the hint like it is random and exp is really helpful . I somehow reached at (i , q[i]) until i == p[i] with exp == 2 . Even i found exp == 3 in some cases .But the sad part , i could not combine up things to get to (3 + 2)n/2 ... This is nice and intuitive sol , better from less intuitive editorial .

    • »
      »
      »
      9 months ago, hide # ^ |
      ← Rev. 4  
      Vote: I like it 0 Vote: I do not like it

      using chebyshev to bound the probability of failure is approx atmax 5 % . under 50 to see it , with 2.5% very low probabiltiy to occur , the 5% is still loose ...

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

    E you can just try to put 1 and n in their places and then repeat on subarray p[2..n-1].

    Code: 352082213

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

      some details:

      you can put 1 in the correct position immediately with EV 2, and you then try to put n in the correct position as well. Let x be the number of swaps it takes to fix n. We know that x = 1/2(1) + 1/2(2+x) -> x = 3 (either you fix n immediately or you ruin 1 so you have to fix it with two swaps and then you have to fix n). This takes 5 swaps, and you do this n/2 times

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

        normally this : "x = 1/2(1) + 1/2(2+x)" should have been :"x = 1/2(1) + 1/2(3+x)" accounting for 2 moves to fix 1 and the previous wasted move on n , but in our case it is correct because : ruining 1->try to fix 1->fail ----> fixed n!!! so it would be (1+2+x-1) which is (2+x). correct me if I'm wrong .

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

I struggled with C, got a TLE. I felt B was easy the instant you realised that it was a DP problem

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

Is the complexity of the model solution for problem F $$$\mathcal{O}(q\sqrt{n}\log n)$$$?

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

sol C?

  • »
    »
    10 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it
    • Sort the array a in non decreasing order. Make a visited array too.
    • Then starting form index 0 in a, we check if it's visited or not.

    If not visited then simply no one is there before it that is it's divisor. So, it should be added to our array ans. - And all it's multiples ( ≤ k) should be marked visited as no need to add them to b.

    If  `a = {3, 4, 6 , 9, 12}`
    then no need of adding both 3 and 6 to b as for 6 all conditions are met by 3.
    Still getting Wrong Answer??
    Code
»
10 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Anybody felt B was harder than C ? C was kinda too direct...

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

    agree to some extent ...

    although my DP directly worked on B .. but C also had cool observation to make and to know that time complexity will be bounded

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

      how did you approach C , i got stuck in the implementation part

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

        so one observation ... if x is in the set A then all multiple of x has to be in A else answer is -1 ... this is true as if I have divisor of x say d in B.. then all multiple of that divisor should be in A ... and any multiple of x is multiple of d

        so this way we can just check of all multiples of x ... note that this limits how many checks we do ... coz we can at max do n checks .. like if x have more than n divisors <=k ... then we will anyway fail

        and to minimize the size of B ... we just take all the numbers which don't have any divisor smaller than that number ... this we can get in previous procedure only

        sorry if it is confusing ... but core idea is if x is in A .. then all 'multiples of x' <= k should be in A

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

          I thought the same way but still my code's time exceeded 2k ms . Can you give me outline of your implementation ? was it precomputation?

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

            can you check this submission 352050780

            pro variable is the multiple of x which is member of A .. but note that I am iterating on x again if I have not seen it before like .. if you have 2,4 in your array ... when you iterate on multiples of 2 .. u mark 4 as seen and should not iterate on 4 again.

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

            I really hope it's not due to the unordered_set. See https://codeforces.me/blog/entry/62393

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

              I could never think of this since i never participated in hacking after the contest . Thanks a lot , added to my templates.

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

        See mine. I knew that I 1) would need to process the elements in ascending order, 2) will need to check if some x exists in a or not, and 3) will need to mark which a[i] has some factor in b, so I chose map<int, bool>.

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

so I broke the curse of getting cooked on problem B .. but to balance that .. one WA on problem A ... aaaaahhhh!!!!

also problem D felt like it is possible to solve it but I couldn't do it :(

I was trying something like first using <k-1 moves form longest chain of 1s and then just collapse biggest chains of 1s kind of !!!

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

    D is very good problem

    1110000000111 and for k=2 answer is 6 , my code was broke to this testcase

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

      similar issue .. I found 111000111 . k = 2 which I was failing LOL..

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

      I feel exasperated after having to struggle with my, otherwise correct, solution because I assumed k > 0. I was missing if k == 0 then 0. :<

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

    Your idea fails for n = 110110000110011, k = 5. Answer would be make two chains and collapse both getting a score of 11. Your strategy would yield 6 (from the longest chain) + 2 + 2 = 10. Hint: You can create more than one chains by filling holes. Think of the upper bound on the no. of holes.

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

      ok great thanks for sharing this case ,, now I don't feel bad that I was near the solution, and missed because of time LMAO !!!

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

do you guys have extremely stable internet connection, or does it fluctuate a lot while giving contests(getting stuck on verifications, or site not opening)??

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

    It's a mess. For some reason I could not open the update popup on D. So I had to go to contest dashboard to read the clarification. Cloudflare disrupts on each refresh or page open.

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

    I always keep the m1/m2/m3 versions open for this.

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

    queue was bit slow for me.. but other than that it was OK for me

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

    yea i solved C at around 15 minutes but couldnt submit until at 22 it kept telling me unexpected error when i tried to submit

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

Hi, thank you so much for the great contest!

Just one issue i had mid-contest, for problem C. canades perfect multiples, on the first test case the exemplary output for $$$t = 1$$$ is incorrect and caused me some troubles. in the problem set page it shows the expected test case output to be: 2 2 3 1 1 -1 1 2

however the judge's expected output was: 2 3 2 1 1 -1 1 2 this frustrated me quite a lot since it made me think my solution was incorrect in terms of logic, regardless, thank you so much for the contest! :)

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

    Well, with the first test case both 2 3 or 3 2 are correct so I think there's no issue with the sample test case and explanation. Hope you had a great experience :)

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

      Ah thank you so much, I am stupid hahaha, I got too burnt out seeing my solution not passing the pretests, thanks so much))

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

What a cancer F was

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

ho ho !!

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

Shayan It is really unethical to attach your obviously ChatGPT copypasted editorial and try to pass it off as your own, and perhaps more importantly, pass it off as an "official" editorial.

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

    I totally agree. Why are you posting such editorials like 1 min after contest? Shayan

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

    where is that editorial ?? why couldn't I find :(

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

    We are sorry for the issue. The authors don't know anything about that editorial and we have wrote another one which was finished before the contest and hasn't been published yet. We totally agree with you, and promise that the editorial created by the authors is written with care, not anything copypasted from AI.

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

    Thanks for mentioning me. I was in the livestream and I just could check this.

    The solutions there are the same as the ones I explained in the livestream. The text is written with the help of LLM. (and not only texts, but added charts, example walkthroughs, etc.) Do you think there was anything wrong with using LLM to improve the quality of writing? Or do you feel like LLM has solved the problems? (which might be impossible)

    But the main point, "official" editorial, it's definitely not the official editorial. Can you PLEASE clarify what made you think it is the official editorial?

    All comes to my mind is that I should write a post and explain in detail what these editorials are and how they are made. I'll also add a disclaimer to them that mentions it is not prepared by the authors and it's not official. Sorry for the confusion. (and obviously feel free to downvote this or anything if it helps)

    Anyway, we have started this new feature recently, and from now on we will release the editorials of all of the problems instantly after the contest ends on the community.

    I didn't like the judgemental tone of the comment when we are really trying to add value and we've already done so much for parts of the CP community. But still, I should thank you for making us aware that such confusions might happen.

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

      dont make a joke of yourself. You are not a tester and neither did you submit the problems; how do you claim to make the editorials of them?

      "Your" solution to F is obviously flawed, and degenerates to quadriatic on really basic cases, so I highly doubt you coded it and it passed. Since you are an IGM, I would trust you to see this flaw easily if you actually solved it, but it seems you are too busy discussing the AI solutions instead of verifying them.

      I didn't like the judgemental tone of the comment when we are really trying to add value

      "Your" editorial added 0 value, own up to your mistakes and try to do better.

      Can you PLEASE clarify what made you think it is the official editorial?

      The fact that it's linked to the official contest with no clear indication of being unofficial.

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

        If the solution is flawed or something, we will fix it. I'm not preparing the editorials alone, and I'll think of a better way of verifying the solutions from next time. I'll also list the name of the people who are working on the editorial from next time with clear attribution. Maybe it will solve your doubts.

        You are looking at it from your own lense. You just looked at problem F and it didn't help "you". I'm in contact with thousands of CPers and I'm seeing firsthand what value we are giving them. If you don't want to see the value we are providing, that's another thing. But I still don't get it why I should see such a comment after all the efforts we make.

        My editorials are attached to the problems for over a year now! And definitely this is not the first time that the solutions I provided have flaws. How come you didn't find the previous ones official. If it was your first contest I would understand it, but you should have definitely seen that my editorials (and other people who prepare editorials) get attached there.

        I learned my mistake, and I thanked you for mentioning that. I now know that I should make everything transparent, especially the process of preparing the editorial to avoid confusion. And we'll try to do a better job verifying the solutions next time.

        Anyway, this was our first time for instant editorials, and it will improve. You will find value in it too. It is normal that we make mistakes till we get to a point that we can give high quality content.

        Just give it time, soon or later, you will find the instant editorial feature amazing.

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

        Also, for over a year, I'm not a tester and I haven't submitted the solutions, but I hold the solutions discussions and solve the problems for people. (and believe it or not, rarely solutions have flaws) I don't know why you are asking this question after a year.

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

In contest time I try, but can't prove tc. Can anyone explain the time complexity of problem c. https://codeforces.me/contest/2173/submission/352073897

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

    it is nlogn , because at worst all n elements are divisible by any A[i] , we iterate for all multiples of a number till min(n,k/x), where x is the current best

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

How does the solution in the editorial not TLE if the time complexity is $$$O(n^2)+O(ksqrt(n))$$$?

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

Why were hacks disabled?

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

How is the main solution for F passed?

t = 1 n, q = 150,000 a[i] = 2

l = 1, r = n, x = 3

your code will query in O(n log(n))

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

    It is not any form of official solution. We don't guarantee the user-created editorials. Please wait for our official editorial, and do not trust such gpt-based things

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

    Sorry, that's not our main solution and the authors didn't write the editorial which was just published. We wrote another one and it hasn't been published yet. Sorry for the confusion and the problems about the editorial.

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

      There was a tutorial added after the contest but now it seems to be removed. I don't know if anyone with some rights can add/remove editorial other than authors. However, great problems thanks for the contest.

      Here is the fake editorial that I am talking about if anyone wants to have a look.

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

How tf do i add ts image

how did i perform this dogshit and am i missing anything for c? i am getting tle

»
10 months ago, hide # |
 
Vote: I like it +10 Vote: I do not like it
AC/WA/RE/TLE automaton
»
10 months ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

The code given for problem B in the editorial is giving Wrong Answer for test 1. Anybody help is the logic correct or code is wrong?

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

Is there a greedy solution for D?

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

Here is my screencast with facecam:

https://youtu.be/fYqbHDVyhGc

problems were nice, but found the wordings a bit tricky. Also the queue was long in the beginning causing some disruptions.

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

I think D has a weak tests because my solution in $$$O(40^4)$$$ per testcase got AC

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

I never expected to see Plastic Memories and Isla in a codeforces contest... (PEAK)

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

I'm so glad to see toradora in problem D:)

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

Is uphack also disabled for problems A-E?

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

.

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

Why does this code seem so brute-force and run so fast?

352052654

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

Congratulate me, its my first contest :)

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

very close c :(

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

Please reschedule the contest

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

For problem B, I managed to write a recursive solution and added memoization to it. But it is giving TLE error. Can anyone please explain what is wrong with this solution, or whether the memoization applied is correct or not? Submission link- [submission:https://codeforces.me/contest/2173/submission/352059981]

typedef unsigned long long ull;
typedef long long ll;

ll solve(const vector<ll> &a, const vector<ll> &b, map<size_t, ll> mp, size_t i, ll score)
{
    if (i == a.size())
    {
        return score;
    }

    if (mp.find(score) != mp.end())
    {
        return mp.at(i);
    }

    ll score1 = score - a.at(i);
    ll score2 = b.at(i) - score;

    return mp[score] = max(solve(a, b, mp, i + 1, score1), solve(a, b, mp, i + 1, score2));
}

int main() {
    // ...
    return 0;
}
»
10 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

what? Why i was banned on task C? it is very short task, i even don’t know person

and C is very short and trivial, also i solved a lot of tasks

why we have plagiarism checker on task with such short code? I solved round honestly

Внимание! Ваше решение 352030950 по задаче 2173C значительным образом совпадает с решениями других участников и находится в группе одинаковых решений yaroboy/352030950, kr25161/352043199. Такое совпадение является явным нарушением правил. Отметим, что непреднамеренное утечка тоже является нарушением. Например, не следует пользоваться ideone.com с настройками по умолчанию (публичным доступом к вашему коду). Если вы имеете неоспоримые доказательства, что совпадение произошло по причине использования общего источника, опубликованного до соревнования, то напишите комментарий к посту о раунде со всеми деталями. Подробнее можно прочитать по ссылке http://codeforces.me/blog/entry/8790. Такое нарушение правил может являться основанием для блокировки вашего аккаунта или других штрафных санкций. В случае повторения нарушений, ваш аккаунт может быть заблокирован.

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

Hello, I received a plagiarism warning for my submission: Problem E2 – Submission 352226259.

I want to clarify that I wrote the solution completely on my own. I do not know the other participant whose code resembles mine, and I did not share my code with anyone.

It actually took me a lot of effort during the contest. After solving problem C, I spent almost an hour understanding how to extend the idea to E1 and E2, since they were the easy and hard versions. I finally managed to get both versions accepted, and I was very happy about it.

It is disheartening to see this message, but I assure you that I never posted my code anywhere publicly, and I never communicated with anyone during or after the contest.

I request you to kindly review my case manually and consider my sincere efforts.
Thank you.

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

I rewrited my DP code in problem D, using the Thought $$$\text{Total Happiness} = v_{final} \cdot (n + 1) - \sum_{t} \text{index}_t \cdot (v_t - v_{t-1})$$$,the code using the VScode complete to accelerate the solution of this problem because of the coming end,I copy the Previous Similar DP Template(more C style) that I had at the head of this solution,and auto complete some initialization code. I think other contestants might have used this method as well.So maybe it's the reason that plagiarism checker think the code is copyed.I request you to kindly review my case.Thank you

Attention! Your solution 352236933 for the problem 2175D significantly coincides with solutions hduysf_20/352204122, hrushikeshhh/352207267, advaitpat9/352209735, Radian666777/352210371, demonkavyansh/352216015, Ali_Adelkhah/352219791, t1anze/352236933. 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.

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

..

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

i followed all the rules and gave the contest honestly. iam not related in any manner with the other person involved with whom my code matches significantly!. remove the plagarism !

Attention! Your solution 352043199 for the problem 2173C significantly coincides with solutions yaroboy/352030950, kr25161/352043199. 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.