Igor_Parfenov's blog

By Igor_Parfenov, history, 16 months ago, In English

Hello!

On Dec/08/2024 17:35 (Moscow time) we will host Codeforces Round 992 (Div. 2).

The problems were written and prepared by Igor_Parfenov.

I would like to thank everyone who made this round possible:

This round will be rated for participants with rating lower than 2100.

You will have 2 hours to solve 6 problems.

Score distribution: 500 — 1000 — 1500 — 2000 — 2250 — 2750.

Good luck!

UPD: Editorial

UPD: Congratulations to the Winners!

Div.2:

  1. daniel6202

  2. younesg

  3. houseof

  4. HUST_USELESS

  5. FatihCihan

Div.1 + Div.2:

  1. jiangly

  2. maspy

  3. Rubikun

  4. BurnedChicken

  5. neal

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

| Write comment?
»
16 months ago, hide # |
 
Vote: I like it +60 Vote: I do not like it

Shortest description for a Codeforce Round I've ever seen. Good luck all :)

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

as a non-tester i love playing undertale

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

Hopefully, the problem statements will be short and precise just like the announcement!

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

Can you explain to me why does everyone care about score distribution? I don't get it. Does it correlate with the complexity of the problems? And if so, in what way?

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

    Yeah higher the jump in between the problems higher is the difficulty change

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

      So am i right that this contest is going to have a significant jump between first 3 problems? Cause it's much more often them to be like 500 750 1250.

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

        You can expect so. Usually a distribution of 500-1000-1500 means the problems are rated around 800 — (1000-1200) — 1500 respectively. There are exceptions of course (the last two div2s having 800-900-1200 and 800-900-1300 for example). In fact, a 1400-rated problem B in one of the recent div2s only granted 1000 points.

        I think that 500 1000 1500 is more common than 500 750 1250 though.

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

I hope to become Expert after this round 0 ^ 0

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

My first unrated Div.2

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

good luck

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

Best of luck to all participants—let's enjoy solving and aim for new personal bests! ᓚᘏᗢ

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

everybody best of luck give your 100% with best wishes

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

I want a rating boost, so should i go with solving problemB first and then problem A?

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

xD

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

Expecting increase in rating

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

As a tester, I hope you get a lot of green in this contest.

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

it will be the rated contest number 100 for me <3

I hope to perform well in this contest ^_^

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

Hoping I could get to expert

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

Hopefully I wont choke on A this time :)

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

i feel so stupid failing c

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

patternforces

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

C is going straight to my suicide note.

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

Is F on Burnside's lemma?

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

can someone explain to me the idea behind b i feel too dumb tbh...

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

D is serious?

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

How to D?

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

    Keep track of a value you will assign to the nodes, starting at 1. DFS and use precalculated sieve to determine when a parent-child value difference is prime, in which case increment the value by 1 until it is no longer prime. The number of increases is upper bounded by about n/2, which ensures the value never exceeds 2n.

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

    Just fill everything in dfs with odd numbers starting from 1. When you fill children of some node u, skip odd number x + 2, where x is the parent's odd number. In the end you'll have at most one unfilled node, so just fill it with even number x + 1, where x is the parent's number. It works because the difference of two non-adjacent odd numbers is an even number greater than 2.

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

    Another solution: solve in dfs order for subtrees first, then when combining add 1 to the whole first subtree and starting from the second subtree add double the size of all previously considered subtrees plus 2 to the whole now considered subtree. After the first dfs, the final answer will be obtained by going to the leaves from the root and adding all calculated values plus 1.

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

C I gave up on observations and just generated $$$n=8$$$ permutations and found patterns

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

    that's the first thing to do for permutation problems

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

    Can you explain further? Did you do this on pen and paper (seems like a daunting task), and if you did this via code — did you calculate S(P) for all of them manually?

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

      Yes, I did this in code and calculated S(P). Python has many nice features that make this pretty straightforward and fast. You can use itertools to generate all the permutations easily and S(P) isn't too hard to code.

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

    what was the pattern I sill didn't get it?

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

    I started by thinking of maximising sum of intervals of each length. Realised you can't really get better than, say, for n = 5, for intervals of length 2 you can get at best 1 + 2 + 3 + 4. Then for length 3 you can get at best 1 + 2 + 3. And so on. And eventually realised that every piece besides the biggest one has to have as neighbors both a bigger and a smaller than it (considering the edges of the permutation to be 0). So essentially this is like going through the numbers in order and putting either smallest position still possible either biggest. So, like this, for example: n = 4

    0  0
    0 1    0
    0 1   2 0
    0 1   3 2 0
    0 1 4 3 2 0 (this last one will always be the same, whether you try putting it on the left or right)
    

    This can also be written then as either putting left or right. So for the given example it's L R R (you put 1 to the left, 2 and 3 to the right, 4 in what remains). And then finally when I started listing how all combinations of L and R would look I realised that this if you put the combinations in order, their results will literally be in the same order lexicographically, too (if you consider R bigger than L).

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

    Same. I lost track with pen and paper at $$$n = 5$$$ so I just coded up a brute force construction method and then it's pattern seeking from there.

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

mathforces

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

Today I learned that 2 is a prime number :(

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

C was too tough for pupil and specalist Guys.We cant even fight to solve C. Totally Disappointed

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

C is painful for me

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

No idea how to solve C :(

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

    Do a brute force to find the optimal value sum first and then see all the permutations that give the result for some small $$$n$$$ like $$$7$$$. Try to see the pattern.

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

I honestly dont get the point of questions like C.

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

    I liked C but it might have been harder or just as hard as D, which is not very cool. Also someone said they found it somewhere on codeforces, so, it shouldn't have been in the contest.

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

nvm

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

I brute forced and saw the pattern for C, but I couldn't figure out how to implement it for 90 mins, got really frustrated by the end of the round

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

    same, couldnt figure out how to do it without computing 2^n

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

      2^n gets really big really quickly, so you only need to do it for small n (Like <= 50). Then the large case is trivial, because it will be bigger than k.

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

    same bro despite of finding the pattern it is difficult to implement it Does anyone knows how to solve such type of problems please explain , it is much needed ?? Please

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

      you can literally solve this particular problem by making observations and "wishful thinking". See my comment above. But yeah, running bruteforce and figuring out why it looks like that might be faster than what I did. Regardless, realising when to call it quits and run a bruteforce and pattern match is still a skill, isn't it?

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

    same :(

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

help in d please

My thought process : choose 4 as diff and then choosing adjacent node

one will act as root and all nodes in it subtree will be 1 given 1 and increment of 4 , other with 2 and it increments

counter case : for star graphs case i can take other additions also like 1 and 7 for additional nodes,

can't implement it so need help

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

These ppl didnt mention the function in B was ceil, and not floor, and spend half an hour on that lmao, next time hopefully they write its ceil function

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

C was way too tough ig

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

I wasted so much time rabbit-holing in B... so I did D and then came back to B, spent another 20 minutes, and then finally saw the easy way to do it smh.

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

is there anyone found $$$D$$$ was easier than $$$C$$$ ?

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

why is d getting tle d

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

This was not competitive programming, this was competitive math

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

Yeah, it seems to be a very fair thing to not tell explicitly that you are using ceil function instead of floor and then don't even add testcases to make sure it doesn't happen. There's barely a difference between ceil and floor brackets and anyone can genuinely miss it.

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

guessforces + how on earth none of testers noticed about C

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

dear problem setter, please never make problem like C again, never.

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

make this unrated wtf

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

Am I the only person who really liked C? Only reason I found out it was hated was by looking in the comments

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

d is too hard for me :(

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

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

I'm sure for many, the D task was an attempt to just stuff something stupid without even trying to prove it. It's a pity that I only managed to do it after the end of the round. Specifically, C was too heavy for me.

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

I cheezed D with a randomised solution. Basically, I guessed that the ratio of number of "unblocked" values to total values is never much lower than 1/2

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

Who and for what reason decided to add -1 in Problem D?

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

    That's quite common as to not spoil the solution. Alternatively you have to guarantee that solution always exists, but that is not always obvious.

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

      If they wanted to make the problem better, they could have added that maximum node should be as small as possible.

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

        I think the problem is good as it is. How would you solve the modification you proposed?

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

          Not sure, But I would Try to change my initial code which got TLE on 24 test, were I find the diameter of the tree fill with numbers which have difference of one and after that go to subtrees by increasing the number with smalles composite difference and do the same in there, but not sure how to implement it yet to pass in time.

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

Problem C was exact copy of problem : https://mirror.codeforces.com/contest/513/problem/B2

This is extremely unfair to the people who tried this problem for the first time. This also explains why so many people were able to do this problem despite it being good enough that most of my expert friends couldnt do it.

My submission for contest problem : 295640125

Exact same code submission for older version : 295644907

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

    I totally agree with you. What are the testers doing? If it's a problem from another country's website then I can understand why they accidentally made the same problem. But another exact same problem from codeforces????? Insane. It is really unfair for ppl who didnt try this problem like me.

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

I found something interesting while reviewing the official common standing: three participants younesg (rank 2), Constantor (rank 7), and zxc3 (rank 15)—all failed to solve problem D. Upon examining their code, I noticed a significant similarity in problems C, E, and F. Although they paraphrased the code quite skillfully, it’s evident from problem E that there’s clear code plagiarism among them (295598220, 295609438 and 295632243). I hope MikeMirzayanov and Igor_Parfenov can address this case.

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

In E, how to derive the expression "2 * sizeof(vertex) — 1"? Though, i guessed, after this move, move parity will be odd, so, we can go back to the same vertex, using 2 moves and one substraction for parent.

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

    at any vertex you have two choices(if the step is even)- either go down to one of the child vertex or go to the parent vertex... the probability of going to a parent vertex is 1/degree while going to a child node is (degree-1)/degree. let E denote the expected number of steps to reach parent vertex then E= 1/degree + ((degree-1)/degree)*(1/degree)+(((degree-1)/degree)^2)*(1/degree)+........ . Solving this you get the required value of 2*degree-1.

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

did thet tutrioal of D's second idea is wrong,the"write the values n*2,n*2-1,…"should be "write the values n*2,n*2-2,…"

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

I encountered an incident where the code was found to be similar. Here are two submission records: https://mirror.codeforces.com/contest/2040/submission/295612672 https://mirror.codeforces.com/contest/2040/submission/295614629 BUT I'M NOT A CHEATER! Firstly, I assure you that I did not collude with him in the code, it just happened to be similar. Considering that this is a very typical problem and there are not many parts that need to be written, it is very likely that these two codes happen to be similar. So how to handle this matter?