awoo's blog

By awoo, history, 10 months ago, translation, In English

Neapolis University Pafos

Hello Codeforces!

The series of Educational Rounds continues thanks to the support of the Computer Science and Artificial Intelligence (CSAI) program at Neapolis University Pafos, with scholarships provided by JetBrains.

Educational Codeforces Round 186 (Rated for Div. 2) will start on Dec/29/2025 17:35 (Moscow time).

This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest, you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 6-7 problems and 2 hours to solve them.

The problems were invented and prepared by Adilbek adedalic Dalabaev, Ivan BledDest Androsov, Maksim Neon Mescheryakov, Roman Roms Glazov and me. Also, huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.

Big thanks to the testers FelixArg and KIRIJIJI for their valuable advice and suggestions!

Good luck to all the participants!

And on the occasion of the New Year — Happy New Year!

We wish you clear ideas, strong solutions, and many ACs in the year ahead.

UPD: Editorial is out

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

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

first

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

The real Good bye 2025

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

so many cheaters in last round, it's last contest of the year, I hope we don't see another round where 10000 people solve problem C.

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

    It wasn't just because of cheaters, the problem was probably the level of Div2 B.

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

      It was a dp problem and I have seen myself that AI can explain and solve DP very easily that's why I am saying there were a lot of cheaters, even a master level cheater was caught buddy in the contest.

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

        Not a Dp Can be solved by greedy.

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

          I solved it using a dp approach — https://codeforces.me/contest/2178/submission/355396319 and like I said if a problem can be solved using dp then AI easily cracks it because essentially it becomes an optimization problem which is fundamentally how machine learning and AI models work.

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

            AI working that way in the backend does not mean that it's necessarily good at reasoning that way

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

              there is literally an entire paper published by Deepmind (the first pioneers in Reinforcement learning algorithms) which basically tries to prove that Graph Neural Networks are basically dynamic programmers.

              Here is the source — https://arxiv.org/pdf/2203.15544

              I am myself working on RLHF at the moment and I can argue that dp is involved everywhere in RL due to policy optimization, monte carlo methods, etc. These types of methods are used in AI technologies as RLHF (Reinforcement learning through human feedback) and a lot of dp is involved to optimize the policies due to high amount of trajectories (Data essentially). This is why I argued that dp is better for AI compared to other types of problems.

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

                All RL algos are Bellman equation, which is used to solve dp, so it's not entirely true to say dp is used everywhere in AI. Also RLHF in practice barely uses pure DP, but rather approximate DP like value iteration. I think you meant "DP principle" instead of "DP".

                Anyways, "dp is better for AI" doesnt inherently mean "AI can easily solve dp problem".

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

                  Yeah sure, I just wanted to give the idea that dp is involved in optimization and RL algorithms.

                  The whole point of the previous source is that the general dp related problems are easier for AI because of their own architecture resembling an optimization compared to other types of problems. This increases the chances for cheaters to get correct results compared to other types of problems.

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

            Never heard of this paper thanks for the reference going to give it a read.

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

            I am still learning dp, but the first thing that came to my mind was to use prefix and suffix sums on that problem.

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

        It was combinatorics...

        I solved it in my first codeforces contest because I also do olympiad math, also I have given atcoder contest.

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

    I have a question how to get the right and useful solution with the explanation for a problem that I couldn't solve؟

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

there is no way he just did the 67 joke...

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

For Problem 148A A. Insomnia cure, should I study the inclusion, exclusion version that was in O(1) time. Like is it common to see things like that, so I should study it? Do discrete mathematics concepts like that appear sometimes? My solution was really brute force compared to that one.

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

Will score distribution be released soon?

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

Why 6-7

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

Hope you didn't say 6-7 problems just for the meme

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

What does it take to AK this round ?

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

i really hope to reach new max :(

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

Where unrated register?

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

Wish you all have great ending of 2025 with this Educational round.

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

hope for all a year full of new Ranks

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

As a femboy, I am NOT looking forwards to dropping to Pupil this round!

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

Hope to solve at least 4 problems, thus increase my rating.

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

i hope i don't get clicked this time ^_^

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

Hope i can solve ABC

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

haha wtf lol 4k solves on $$$D$$$ and 2k on $$$E$$$?

too easy or all cheaters?

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

D >>>>>> E

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

C should have been better.

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

how 4k people solved d ?? is it that easy ?

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

D >>> E. Shitty speedforces :( Please make a better contest for the end of the year.

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

    please tell Idea for E

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

      I did greedy.

      Step 0: for all Y[i] , k -= Y[i]; remaining value of k is your final budget...

      Step 1: You sort the boxes by the beauty...

      Step 2: You process all the friends in sorted order, and check which all friends could be fullfilled by this box, we keep pool of such friends. among set of all such friends, find a friend, for whom the DELTA of Z[i] — Y[i] is highest and fulfil that friends requirement ( we give him the i'th box, which has beauty more than X[i] ).

      Step 3: After processing all the boxes, now among unmatched friends, try to fulfil their requirement by paying extra from your final budget. for this, we will choose the smallest delta (Z[i] — Y[i]) , (opposite of what we did in step 2 , in step 2 we try to match the highest delta ).

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

      Focus on using boxes for friends with highest z[i] — y[i]. After you've used up your boxes, simply use your remaining k coins to pick up as many of the leftovers as you can, starting with the lowest z[i] — y[i].

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

        yeah I was allocating boxes for z-y, it seems I need to pick z-y for a box ... thanks for the idea !!!

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

        What if z[I] — y[I] is the highest but the y[I] is so high it doesn't make sense to buy anything to this friend?

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

          The problem's constraints gurantee that we will always have enough coins to take all y[i], and we must gift every friend.

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

lowkey have to quit cp ig not improving little bit

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

    same condition here :(

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

    There is still hope. I got $250K+ SWE job despite sucking at CP.

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

    I think you are improving, but due to cheaters, your improvements might not be as visible as they should be.

    My suggestion, Go to past contests, like in 500 to 600 series, and attempt Virtual contest will full focus and see what rank you would have received with your final score... that will help you judge your performance more accurately.

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

C was so bad!

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

How so many solves on C and D? Cheatforces!!

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

Thank you for D and E. amazing problems.

I felt E < D in difficulty.

Also, GAP between C and D was little more than expected, but it was worth it. ( I can't believe so many people solved D !!! ).

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

Great contest! (Though I got a million WAs for no reason on A nd D XD)

All the problems I solved (A-E) where interesting and more or less the right difficulty, and the other problems seem nice, too. I especially loved D!

Only one small problem: E was much easier than D, though I don't think that it affected the contest quality or my performance, so it wasn't a big issue for me

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

2k rank for 4 solved XO

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

People seems to got faster in a few months or I am just getting worse

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

D felt way harder (combinatorics) than E (simple greedy strategy)

»
10 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it
  • couldn't solve E, tried some greedy thing but failed :( , like give boxes to people who might need more coins and then give coins from small requirement to large ..

  • please give hints for E

  • also C was a bit tricky for educational round ... even though it was not so hard but still so many solver surprise me !!!
»
10 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Big clutch for me ig, I forgot that the contest existed until 20 min into the contest

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

How to solve C ?

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

    I used DP ... length of longest valid subarray from ab[i][j] ... meaning u start at index i in a and index j in b

    once you have this .. then it is not so difficult .. but I still feel this was tricky

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

      please visit mine for "c" i feel i have solved it very clean and without dp

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

        oh wow!!!

        can you please tell what that loop is doing .. although it looks cool .. it is mystery to me

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

          see you should not calculate individual i ,j and k rather give some importance to gap sequence like 0,1,2 ..n-1 what i mean is if gap of 0 for a and b exists then for a and b 1,1 2,2 and n,n all exists now it makes sense to see a<b and b<c in a separate way so i tried a little combinatorical approach proving that a<b choices and b<c choices are independent so why not multiply them and eventually multiplying with n cause if one gap is valid then total of n new pairs gets generated

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

    For i = 0, you can calculate all valid j(ignoring k for now) in O(n^2). The number of valid j can be called val_j.

    Note that if i = 1, each valid j is also incremented by one. Therefore, the total number of valid (i,j) pairs is n*val_j since i can be any value and there will always be the same number of valid j.

    Next, we can repeat this logic with j and k. For a given j, the number of valid k is val_k and can be calculated in O(n^2).

    The number of total valid j is the number of valid (i,j) pairs which were calculated above, so the answer is n*val_j*val_k.

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

    if you want a valid pair for i,j,k

    u can break it as number of valid pairs for i,j and number of valid pairs for j,k

    since its a transitive relation

    to compute number of valid (i,j) pairs

    you pick an offset value from 0 to n-1

    and need to check if for all i = 0..n-1 , the j = i + offset, satisfies the condition a[i] < b[j]

    if it satisfies then this offset contributes to a valid pair,

    similarly find for (j,k)

    now the answer is the product of these 2, but these are just in the form of i, j = i + d1, k = j + d2

    but i can start from 0 to n-1

    so answer is n * (number of ways to get pair (i,j)) * (number of ways to get pair (j,k))

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

    I solved it in a stupidly simple way. I don't know if it's correct. for string $$$a$$$ and $$$b$$$, I rotated $$$b$$$ by $$$0,1,...n-1$$$ positions and counted the number of positions by which if $$$b$$$ is rotated, $$$a_i \lt b_i$$$ for all $$$i$$$ (let's call this $$$numCompliantRotations(a,b)$$$.

    the answer is $$$n*numCompliantRotations(a,b)*numCompliantRotations(b,c)$$$ because the three rotations are independent.

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

4K rank for 4 solved.....;(

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

Why is $$$n \le 50$$$ for D when a solution in $$$\mathcal{O} (n \log MOD)$$$ exist?

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

    red herring

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

    +1, re-read the problem statement multiple times to make sure I wasn't missing anything.

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

    It is not given that $$$\sum n \le 50$$$, so the time complexity is $$$O(n \cdot t \cdot \log \text{MOD})$$$ and t is large.

    Although $$$\log \text{MOD}$$$ is not required as we can precompute all $$$\binom{n}{r}$$$ for required range using the formula $$$\binom{n}{r} = \binom{n-1}{r} + \binom{n-1}{r-1}$$$

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

D absolutely kicked my ass. Can I have a pointer on it? I was thinking it was something DP related which is a big weakness of mine.

I was thinking of sorting the private boxes, then somehow making dp[k] being the ways to pick k people fairly?

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

    Why makes a permutation unsuitable? Given that there is a valid permutation(answer > 0), what differentiates permutations?

    Once you figure this out, the rest becomes intuitive.

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

      A permutation is unsuitable when there isn't enough in the public box to cover the 'debt' difference between the private boxes and their maximum; to put it loosely. Permutations are differentiated by their orders.

      So say we make the maximum private box our K'th box, then our permutation count is the possible permutations of our 0th to K-1'th box, multiplied by our K+1'th box to N'th box.

      Add these permutations up, and we get our answer.

      I think I get it now, thank you so much for your help.

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

    I did it this way: first balance box 0, then to make it fair, either all elements must be x or x followed by x-1. Since you can only add to balance, x at least has to be the largest element in the boxes, so we can divide it into two zones, the quantity x and x-1, find the quantity in different ways with permutation and multiply them.

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

Was F1 like a binary digit dp?

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

From where to read the solution editorial there is no stream for it's solutions i solved A was stuck in B was very close to solving it couldn't no gpt rule so where can i read the solution ?

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

Miseed F1 by 5 minutes, feels bad man.
 Image
The only Diff between wa and ac

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

    Yes, if the number of digits shifted to the left exceeds or equals the number of digits of the data type, the result is undefined.

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

Great round!

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

How 9k successfull submissions for C ?

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

    It was quite a simple problem, your answer is |a|*f(b, a)*f(c,a); where f(x, y) is the number of cyclic shifts of x such that y_i < x_i.

    You can get to this by realising that you can only produce all n snowmen if a_i < b_i for all i, and likewise for b and c, given a specific cyclic shift.

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

WA on D because I think when n = 1 the answer can be 0...... ;(

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

Hope we will all get good ratings before 2026 ! :)

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

4000 AC on problem D? CP nowadays is becoming a nightmare for legit contestants

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

I couldn’t understand how come such a huge number of participants came up with a bitmask solution for Problem A, most of which got hacked. But when I copy-pasted the problem into ChatGPT, it became clear.

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

Huge cheating on d and e

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

May someone explain why is n not greater than 50 in D?

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

    awoo constraints ;)

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

    cause there isn't obvious non-deliberate worse time complexity solution, maybe.

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

      0_0

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

      I actually solved it in O(N^3) using dp. I thought it would tle but apparently it is fast enough.

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

        Can you please explain your DP solution.

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

          I would recommend waiting for the editorial because I think my solution will turn out to be completely unnecessary/missing something, But here you go:

          I started by looking at the condition that makes the permutation fair.

          First, let $$$S = \sum a_i$$$ (summation of all $$$a_i$$$ from $$$0$$$ to $$$N$$$).

          Each player will play for $$$\lfloor S/n \rfloor$$$ rounds. Except for the first $$$S \pmod n$$$ players, who will play an extra round.

          Each player will try to use only his box until he finishes it, and only then will he use box $$$0$$$. So he will consume $$$\lfloor S/n \rfloor$$$ gifts in total, $$$a_i$$$ of them from his own and the rest from box 0.

          Additionally, He will consume an extra decoration if he lies in the first $$$S \pmod n$$$ positions, he also greedily consumes it from his box if possible otherwise box 0.

          If the sum of those consumptions is $$$\le a_0$$$, then the permutation is fair. Otherwise, it is not, because if it exceeds $$$a_0$$$, then box 0 will run out too quickly and one of the players won't be able to play.

          Now the problem becomes: who will I assign in the first $$$S \pmod n$$$ positions, and who will I assign in the following $$$n - (S \pmod n)$$$ positions?

          This is what I use DP for. My state is $$$dp(pos, sub, amnt)$$$: * $$$pos$$$: current player being considered. * $$$sub$$$: how many players from the first $$$S \pmod n$$$ use a decoration from box 0. * $$$amnt$$$: the amount of players that I need to select to be in the first $$$S \pmod n$$$ spots.

          The transition is just: either put them in the first $$$S \pmod n$$$ group or put them in the other spot. For the base case, I just multiply by $$$fac[S \% n] \cdot fac[n - (S \% n)]$$$ to account for all possible orderings of this grouping.

          Keep in mind most people had simpler solutions, I haven't upsolved yet but they probably exploited something I haven't noticed so that they don't need DP.

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

        I could have implemented my solution in O ( N ) I believe .

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

Looks like if I want to reach expert then I need to consistently do D :(

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

how can i get the editorial?

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

does anyone know if we can solve problem F1 with the help of segment trees, and if yes, then how?

i tried to do it but couldnt, the type 3 query was making it problematic for me. i would really appreciate if someone could tell if there is a way to solve using segment trees.

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

    seg tree?!? may i suggest using static array instead sir.

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

    I also tried and failed, but I think my general idea was close.

    Think of it like digit dp with dp[pos][tight][started]. DP is not necessary, but the ideas are useful. Considering started as an implementation detail, and pos as each bit, you can iterate downwards through the bits. Let's also define t as the number of bits greater than our pos which are in the x. Let us also assume tight is always true.

    If the previous bit present in x is p, we can do some casework. If we select the next number to be at a bit in (pos+t, p] then the number will be greater no matter what the next bits are. For each number we can choose, we add w * 2^z to the final answer where z is the number of integers in [0,p] excluding our current number. w is the number of ways to reach this position(will be defined later).

    If select the next number to be at a bit [0,pos+t), the number is smaller resulting in no solution.

    Finally, the next number is equal to pos+t, the number is not guaranteed to be big enough but also not guaranteed to be too small. I defined w as the number of ways to reach this position. The transition is just w *= segtree[i]. This does not add anything to final answer, it just increases the number of ways for the case where the next bit is greater.

    The final case(which I ran out of time for), is applying w at the end of a number. The value of w after going through all digits expresses the number of ways to hit exactly x. Based on p, you can consider every subset of future numbers(2^z where z = size of ([0,p]-1)), and then add it to the final answer.

    I didn't get the problem, so I'm not sure, but this was my idea.

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

How to calculate the CP can be very confusing sometimes, but I don't think that really makes it harder to solve D than E, since the method is already there. Sadly, I didn't manage to solve E since I'd wasted to much time figuring out D =(

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

For some reason, I found D (4000+ AC DAMN) to be much harder than E, Was able to solve D in last minutes, and post contest, just took 3-4 minutes to come up solution for E.

I basically fixed the maximum element first. Every other element (those < Max) must use box 0 at least Max − a[i] − 1 times to “catch up”, assuming they all sit to the right of the Max element. After subtracting these mandatory uses from a[0], if R becomes negative the answer is 0.

With the remaining R extra uses of box 0, I choose how many of those right-side elements can be moved to the left of the Max block. Let F be the count of elements equal to Max. Then for i = 0…R, I place (F + i) elements on the left, compute the number of ways using factorials + nCr, and sum them up

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

how to solve c ?

what i had in mind, is to to fix array a and try all allowed rotated array's for b and c

but i couldn't get how i,j and k's can be counted.

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

we should learn from these coders , rank 17,20,18,19 they solved all 8 questions in their first contest , they should be awarded by codeforces @MikeMirzayanov

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

A quick (scientific) note to the authors pertaining to F1/F2:

The carrying capacity of a population (a group of a species) is the amount of organisms that can be sustained in the environment. It was pretty clear towards the end you were referring to carrying gifts, but just a FYI.

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

Good Bye 2025

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

I want to report cheater wegokic234 with using LLM

Here https://codeforces.me/contest/2182/submission/355745999

And you can see this code has if (!(cin >> ... ))

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

By when the ratings are supposed to change ?

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

A great goodbye for 2025!

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

What's the expected rating of Problem C ?

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

Hello Contestant, My name is not showing on standing table — What's the reason behind this, please anyone can tell me?

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

    one needs to be a trusted participant (means one must have participated in atleas 5 contests and solved 1 question in them ig) but you can go to your profile, friend yourself, and then see your standing in friends standings

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

Another way to solve C

numValidTriplets = numAllTriplets - numInvalidTriplets

numAllTriplets = n^3

We can compute numInvalidTriplets as follows:

numInvalidPairsAB = No. of pairs in A and B which violate condition (Pairs with same drift count to one pair)

numInvalidPairsBC = No. of pairs in B and C which violate condition (Pairs with same drift count to one pair)

However, these are just pairs across two arrays and we will need to exclude duplicate triplets while deriving invalid triplets from these invalid pairs This can be computed as n*numInvalidPairsAB*numInvalidPairsBC

numInvalidTriplets = n*n*numInvalidPairsAB + n*n*numInvalidPairsBC — n*numInvalidPairsAB*numInvalidPairsBC

Hence solution will be: n^3 — (n*n*numInvalidPairsAB + n*n*numInvalidPairsBC — n*numInvalidPairsAB*numInvalidPairsBC)

https://codeforces.me/contest/2182/submission/355838323

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

Is this contest unranked?

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

67

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

So let me get this straight, this guy https://codeforces.me/profile/Ananya_CodeNova has a Youtube channel https://www.youtube.com/@CodeNovaYT where he is live streaming contests and displaying solutions directly and pasting them into YT comment section, Telegram group and google drive.

Not only he is not banned, his submissions are not even skipped.

Additionally, there are at least 10-15 contestants in the top100 of this round that have basically identical code and not even they are banned.

This is an absolute joke.

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

    I mean there's nothing that can be done cheaters would return from alt accounts best we can do is enjoy problem solving and let those cheaters rot

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

      Doubt they would keep returning if they're banned after 1, max 2 contests each time. But since even the blatant cheaters like the one I mentioned above are not banned, it's obvious that nobody in the CF leadership cares about these issues.

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

    He solved till E in just 20 mins. Were Questions leaked?

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

      I have checked his submission and I believe that all of this code was written using chatgpt. I can only be grateful that I have solved more problems than chatgpt.

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

when will ratings be updated?

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

Where rating?

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

Why did i not get any rating from this contest even after solving three problems? Is anybody else facing this problem and does anybody know what to do?

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

Tutorial for D:

Prerequisites: Factorials, combinations $$$n\choose r$$$, stars and bars, inverse factorial modulo $$$p$$$ using Fermat's little theorem

There are two important observations to make.

First, we can assume that every person takes from their own box first until it runs out before taking from the common box. If this were not the case, then someone had the choice of either taking from their own box or the common box, but chose to take from the common box instead. We can only be worse off in this situation, since that person could have potentially taken away a gift that someone else needed whose own box was empty, so we have less chance for the permutation to be 'fair' in the end.

Second (this is the crucial observation to make), the number of 'rounds' that the simulation lasts (that we care about) is $$$\max_{i=1}^n a_i$$$. To think about it easier, assume that the common box had an infinite supply of gifts (or simply some large enough number to ensure that anyone can take from it when their own box is empty). Once the last person (or last few people with $$$a_i=a_{max}$$$) finishes taking gifts from their own box, then everyone would have an empty private box, and whatever is left in box 0 can simply be taken until it runs out.

If at any point in time before the last round, someone is unable to take from both their private box and the common box (both $$$a_i$$$ and $$$a_0$$$ are 0), then there are no fair permutations at all and we can return $$$0$$$. Since it does not matter what permutation the boxes are in if there is at least one person who always runs out of gifts to take before the last round regardless of the permutation. To be clear, one 'round' is when we loop through the persons from $$$1$$$ to $$$n$$$, and each person takes from their own box if it is not empty, or otherwise takes from the common box. In every round before the last, we only care about the value change in each person's $$$a_i$$$ as well as the change in $$$a_0$$$, not the order in which they change, since they all result in the same change regardless of permutation (non-empty $$$a_i$$$ decreases by 1 and $$$a_0$$$ decreases by number of $$$a_i=0$$$ which are forced to take from the common box).

Let's assume there is enough in $$$a_0$$$ to support everyone until the last round (otherwise we can simply return 0). We can split into two cases, one of which is easy. Let's assume there are $$$m$$$ people with one more gift in their private box, and $$$n-m$$$ people who have nothing in their private box and are forced to take from the common box. Then if $$$a_0\geq n-m$$$, there is enough in the common box to support all those with empty private boxes. This means that regardless of whichever permutation we chose, there will always be enough in the common box to support everyone through all rounds, so the answer is $$$n!$$$.

Otherwise, $$$a_0 \lt n-m$$$. In this case, only $$$a_0$$$ of the $$$n-m$$$ people can take from the common box. The other $$$k=(n-m)-a_0$$$ are forced to be the last $$$k$$$ in the permutation. They cannot come before any of the $$$a_0$$$ people who are taking from the common box, nor any of the $$$m$$$ people with one more gift left in their private box. This is so that the process ends before they have to take a gift from $$$a_0$$$ (now empty), so the permutation remains fair.

So we have to choose $$$a_0$$$ out of $$$n-m$$$ people, permute the people who take from the common box, and permute the people who are forced to be the last $$$k$$$. There are $$${{n-m}\choose a_0}\cdot a_0!\cdot k!$$$ ways to do this.

For the $$$m$$$ people who have one more gift in their private box, they can be placed anywhere in the first $$$n-k$$$ positions. An easy way to think about it is, count the number of ways to insert $$$m$$$ people into $$$a_0+1$$$ bins (the $$$a_0$$$ people are 'bars' or separating dividers and we can insert the $$$m$$$ people anywhere beside them), then permute the $$$m$$$ people. An even easier way to think about it is: we have $$$a_0 + m$$$ people in the first $$$n-k$$$ positions; choose $$$m$$$ of those positions i.e. $$${a_0+m}\choose m$$$.

So the final answer is $$${{n-m}\choose a_0}\cdot a_0!\cdot k!\cdot {{a_0+m}\choose m}\cdot m! \mod 998244353$$$. You can simply precompute the factorials and inverse factorials and use them in the $$$nCr$$$ formula.

Submission: 355849613

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

When the rating score will come?

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

It says the round will be "rated for participants with rating below 2100". I'm a newbie with rating 382 (just started cp), I solved 2 questions, but in my profile it shows this contest as unrated, and no rating change has happened..can someone pls explain.

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

Hello everyone. Have a nice day. Where is our ratings??

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

well i had fun

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

good bye 2025 , finally I reached pupil

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

I have a question how to get the right and useful solution with the explanation for a problem that I couldn't solve

THANKS :)

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

hey everyone, just started doing codeforces again, anyone have any idea how many ques i need to do in div 2 to reach pupil and any tips to reach fast?

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

Today, I received a message regarding my solution for problem 2182E (New Year's Gifts) in this round, which has resulted in a plagiarism flag and a significant rating penalty, resetting my score to 420. I want to clarify that my solution was developed independently using standard competitive programming techniques. The structure of my code specifically the use of a suffix-based greedy scan combined with a priority queue is a well-documented algorithmic pattern. This logic is almost identical to the optimal approach for CF 1140C (Beauty of Playlist), a problem I have studied extensively to understand how to manage resource constraints efficiently.

**https://github.com/sourabhkanojia/CodeForces/blob/master/1140C%20-%20Playlist.java**

The variable names I used, such as pq, cnt, grp, and cap, are universal abbreviations taught in standard tutorials and found in public educational repositories like Prakash-sa/Competitive-Programming. My implementation follows the standard "Greedy with Heap" logic used to solve resource-limited selection problems, where one iterates through a sorted constraint and maintains a pool of candidates in a heap. I believe the similarity to other submissions is a result of this being the most direct and efficient way to implement the greedy strategy required for this problem. I have always worked to improve my skills honestly.

I deeply respect Codeforces and the rules that keep this community fair, but I must express how incredibly frustrating it is to receive this notification. I worked very hard to arrive at this solution and to reach my rating, and seeing it drop so drastically due to the use of a standard algorithm is disheartening. I request a review of my submission based on these standard practices and my original submission time to restore my account's standing.

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

I received a notification that my submission for Problem E was flagged for plagiarism. I would like to clarify that I wrote the solution myself.

I have a complete local development timeline in VS Code, including autosave history and timestamps showing the incremental development of the code from scratch. I did not copy the solution from any external source or other participant.

Could you please let me know what kind of additional evidence would be acceptable for verification? I am willing to share editor history, intermediate drafts, or any other information that may help clarify this.

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

Can someone help me with C and D. Please, how did you got idea and how to improve implentation.

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

Reporting a cheater, used LLM to write the code.... the submission : https://codeforces.me/contest/2182/submission/355725936 reason, --> No consistency of coding languages that are used... --> there's the various inconsistency in coding style of this person...