Little_Sheep_Yawn's blog

By Little_Sheep_Yawn, history, 7 months ago, In English

Hello Codeforces,

We are very glad to invite you to participate in Codeforces Round 1057 (Div. 2), which will start on Oct/10/2025 17:35 (Moscow time). You will be given 6 problems and 2 hours to solve them.

All the problems are written and prepared by me and maomao90.

We would like to give our sincere thanks to:

The score distribution is $$$500 - 750 - 1250 - 1750 - 2250 - 3250$$$.

Hope everyone will enjoy the round!

Editorial is out now!

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

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

Some thoughts of mine (personally): I've used Codeforces for quite some time, and being able to have my round on it is really a milestone for me. I'm quite proud but also a little afraid that the problems may not be up to everyone's appetite, but they are the best I can do. This round marks quite a step for me and I wish nothing but the best for this round to go well!

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

As a tester, I love the problems!

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

Hope to participate there in Pupil rank

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

As a tester, it is recommend to take a look at the activity in the author's profile.

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

Amazon seems to be the second largest rainforest next to bro's problem solving figure.

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

fast

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

Try CF Submitter : https://marketplace.visualstudio.com/items?itemName=DevXSayan.cf-submitter
- Fetch all the problems of a contest inside vscode, run test cases, and submit in one click, all without leaving vscode

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

He doesnt goon , he Greens

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

The score distribution looks great, all the best to everyone!

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

Problems I’m guessing: A — Two Screens B — Binomial Coefficients, Kind Of C — New Game D — Attribute Checks E — Card Game F — Choose Your Queries G — Variable Damage

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

I have a feeling that this round's quality will match the date ... 10/10 :)

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

I so badly wanna give an unrated contest… just for peace of mind.

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

I will enjoy your questions. nu~nu~

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

As a tester, I love this contest and hope you enjoy it too!

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

I can't wait to participate in this wonderful competition !!!

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

can confirm this round will be nice as a participant by seeing __baozii__ and _istil in the testers

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

As a participant, Good luck to Everyone.

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

**Nice Score distribution,, wish there no interactive problem (: **

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

chinese people are built differnet holy fuck, this dude has given 5 contests and solved 5000 problems

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

As a tester, i don't want piece, i want probbbleeems allllwayyys

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

Div 2 thats so good competition for us

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

Oh God, give us a rating, we need one.

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

good luck everyone!!!

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

As a tester, I love this contest and hope you enjoy it too!

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

__baozii__ is finally testing this round

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

Hope i could reach Cyan this time :D

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

Completely amazed by your profile. It's truly inspiring! hope to get +ve delta

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

As a participant, Best of luck Everyone.

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

What will be the penalty for each wrong submission?

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

A Yawn Sean div 2 followed by meta hacker cup practice round. Today is going to be fun!

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

ALL THE BEST GUYS

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

Hoping for positive aura delta this first contest.

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

Please pray that I reach 1200 rating today. Man I'll be so happy if I manage to get a 6k ish rank today.

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

Is it just my code that's in queue for a long time?

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

Submission for D stuck for 4-5 minutes :( .. please check ..

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

extend the time to make cheaters have more time to cheat, wow nice idea

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

good D

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

Geometryforces!!! :(

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

i really liked the contest!

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

In what time complexity did you guys solve F? Anyone solved with a square root decomposition type solution?

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

cant wait to see testcases to see what kinda BS edge case i was failing on problem C

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

Auto comment: topic has been updated by Little_Sheep_Yawn (previous revision, new revision, compare).

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

i am really confused in E why for 36 68

ans is 13, if we take k = 31

then, for all a<31 ans = 0 and 31-36 ans is 1? am i missing something?

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

    I think answer also depends on 68, although I didn't solve the problem.

    I was stuck at same thing thinking we need to find some largest prime less than n ... but then in the given test cases .. answer for 6 7 is 1 .. but 6 10 is 0

    so it depends on m as well.

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

    You have $$$\nu_{31}(32!) = \nu_{31}(33!) = \cdots = \nu_{31}(36!)$$$, so you're not allowed to use it because it would give $$$w_{31}(32, 36) = 10^{100}$$$.

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

    how will you get 1 for x = 35

    best m = 9 and ans = 8 i think

    maybe something else

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

just starred at the screen for 1 hour on D :( anyone how to do it?

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

    I made cases ..

    • first element = last
    • first element = 2nd
    • first element = last = 2nd
    • first element = last element = 2nd last element

    and solved each one with DP .. I am hoping we can do some more analysis and reduces cases or make simpler code

    but I used DP to solve each of them

    Idea of DP is that if we can form a segment of length 'k > 2' with all values equal .. then we can break that segment into smallers segments of length 2 or 3 and answer will remain same .. so the DP only need to look at last 2 or 3 elements

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

      Idea of DP is that if we can form a segment of length 'k > 2' with all values equal .. then we can break that segment into smallers segments of length 2 or 3 and answer will remain same .. so the DP only need to look at last 2 or 3 elements

      can you give an example for this?

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

        yeah so final answer is circular array with some segments having equal values and length of each segment will be greater than 2 ( bcoz we can't have a lone value .. it has to have a neighbor with equal value )

        so . it will be xxxx ..now this can be written as xx + xx LOL

        but to handle odd case .. xxxxx .. it will be xx + xxx

        so I guessed that if the answer is going to be xxxxxx .. then I can solve for xxx + xxx it will give same answer

        what I am saying is if we want to convert last 5 values to 10 .. then answer will be same if I converted first 2 values to 10 and then next 3 values to 10 .. so I don't need to look at segment of size > 3

        sorry don't have formal proof.. was a hunch and worked for given test cases on paper so I tried to code it coz I had no other idea !!

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

          man nice!! thanks a lot

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

          refer to chicken mcnugget theorem

          (or you can use induction)

          base case: 2,3 for n>= 4

          n-1 + 2 + 2 — 3 = n

          if you dont have 3 in n-1, then you must have a 2

          n-1 + 3 — 2 = n

          holds for all n >= 4

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

            no, i mean like proof that breaking groups into size 2 or 3 will not make the answer worse.

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

      wow. i m very sad , why this did not occur to me ?

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

https://mirror.codeforces.com/contest/2153/submission/343006371 , my submission for C, can anyone tell me a test case where it will fail? I am not able to figure out where it went wrong...

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

Can anyone tell me The idea to solve problem D ?

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

    If the array is not circular, using dp can solve the problem(try to think how).
    And somehow, you can solve a circular array by solving non-circular version a few times.

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

Fail to solve D for over 100 minutes ): I believe it has a really wonderful solution (: but it really hits me fiercely when my rating is 2098 ):

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

where is the interactive brooo!

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

In problem D, is it true that the distance between any two adjacent elements that don't need to be changed doesn't exceed 3?

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

C has traumatized me honestly, can you tell why my code fails 343007268

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

whoa!!!

I was overthinking B.. but then I saw so many quick submissions and realized there will be some easy idea

... then I counted set bits in 3 numbers, if at any position we have 2 set bits... we can't make it.

is there any other simpler idea ?

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

    and(&) the 3 equalities and then and(&) equalities 2 by 2

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

    I tried with this.

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

      oh wow .. so clean !!!

      can u please share intuition behind it ?

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

        a&b = x b&c = y a&c = z

        so a&b&b&c = a&b&c = x&y, similarly, a&b&c = y&z, a&b&c = x&z.

        Then guessed that it's a sufficient and necessary condition. LOL

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

          nice !!!

          I was very shocked to see so many submissions for B so quickly, I think I was overthinking

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

Adding cyclic condition in D , just seems like adding forced difficulty.

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

this contest was great for A and B, but i think C was difficult a little bit

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

In Problem $$$D$$$, in the ideal division of the array into blocks, suppose there is a block of size >= 2 and it has some cost $$$c$$$, now we divide that block into blocks of size 2 and 3, so will the sum of the costs of these blocks be equal to $$$c$$$? How are we sure that it will be?

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

    All elements in a block should be equal, so if there is a block sized 4 or above, you can break it down to blocks of size 2 and 3.
    for example:
    4 = 2 + 2
    5 = 3 + 2
    can prove that 2*a + 3*b = n, a,b always exist for n>=2

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

Nice contest, don't repeat this.

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

could someone please let me know why my C submission doesnt work My submission

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

    i thought we distribute all sides/2 as much as possible and then take the remaining largest 2 left also some checks if ans should be 0

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

      try

      1
      4
      3 3 5 6
      

      The answer is to choose all sticks = 17, but your solution gave11.

      It fell under the condition if(cnt == 1 && cnt2 == 0).

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

343005674 : My 1st submission for problem D got timed out after waiting in queue for long time most probably due to the issue in Judge but My soln is correct for sure. Anyone pls help resolving this.

»
7 months ago, hide # |
Rev. 3  
Vote: I like it 0 Vote: I do not like it
DIV2-C

can anybody tell why its wrong ? unable to figure out

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

    before adding the largest two leftover values you didnt check if they satisfy the degenerate polygon condition. Just run a loop and check for which two largest consecutive pair their absolute difference is strictly less than your current sum.

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

      still wrong tc2

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

        343027901

        Just checking through the leftover was not enough. It may happen none of those pairs satisfy the degenerate condition. In that case you had to check if you can really make a polygon with your already picked sides else print 0. Also there is another edge case where even if leftover size is not 1 we can pick only one of the leftover elements and not a pair. In that case adding an extra 0 made the checking easier

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

SHAWW!!

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

PC Got TLE using unordered_map after the system test.
Why is it not allowed to use?

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

    unordered_map is known to be a bad choice as it has some operations run in linear time in worst cases. In your code, it's probably the access operator [] that runs linearly sometimes.

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

    code1(TLE)
    code2(AC)
    absolutely the same code, but the second code with a hash template
    I think it shouldn't get TLE just because of using a hash template or not.

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

approach for problem C anyone.

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

Is there an option to see 100 users per page in standings? I am currently seeing only 20.

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

So I just removed 'unordered_' after the contest to get C accepted.

Honestly, I see no point in hiding a system test whose only purpose is to fail whoever used unordered_map with the default hashing. This feels more like a punishment rather than a lesson to learn from.

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

...

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

Fast Editorial! And a Fast Rating Update!

Happy to experience this contest. Thanks Little_Sheep_Yawn

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

sorry, if this comes out as ignorance but I am unsure why my solution gives TLE. It's nlogn in time complexity, something which was within the limits of the qn.

My submission I would really appreciate if someone could take their time out to look into this.

Also, all the test cases mentioned in the comments seem to get accepted by the soln.

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

Video Solution of A,B,C with C++ code of Codeforces Round 1057 (Div. 2): https://youtu.be/u9yVmNV6TrI

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

Very good contest ! Although I didn't solve E (miss an important optimization and keep TLE at test 8), but overall a very good round.

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

https://mirror.codeforces.com/contest/2153/submission/343043896

Why does my code of C give WA at test 4? Pls Help

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

A great Problem D, although I almost solved it during the contest. I figured out the non-circular case and also thought about enumerating split points, but I forgot that trying just three consecutive ones would be enough. Still, this taught me something new, and I believe this kind of problem is truly excellent—devoid of complex algorithms or data structures, yet highly insightful.

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

Video Solution of D. Not Alone with C++ code of Codeforces Round 1057 (Div. 2): https://youtu.be/EU9v463EjvM

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

Salam Aleykum

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

In problem (A) "_Note that you are allowed to skip an apple when you first encounter it, and you can choose to eat it later on a subsequent cycle._"

Is this statement misleading ? Because the 3rd sample testcase is not agreed with it. Or maybe I am not getting it ;(

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

I got flagged for having similar code in Problem D to another user. All my submissions are now skipped. Here's my code: submission, they say it's similar to: submission.

I believe it's a mistake. There aren't many ways to solve this problem, so similar code is bound to happen. While our code structures are pretty similar, you'll notice our coding styles are actually quite different. If someone who can help sees this, could you please review and remove the skipped status? Thanks a lot!

(Used LLM to help with translation, sorry for my bad English owo)

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

gou shi sha bi