Блог пользователя pwned

Автор pwned, 22 месяца назад, По-английски

Hello Codeforces!

We (pwned, ACGN, HappyPacMan, maomao90, Saudi, and trunkty) are thrilled to invite you to Codeforces Round 987 (Div. 2) on Nov/15/2024 15:35 (Moscow time) (note the unusual time)! After more than two years of preparation and nearly thirty problems on our shortlist, our contest is finally here for your enjoyment!

In this round, you will help Penchick as he embarks on a world trip through the Philippines, Indonesia, and even through the Australian beaches and attempt six problems in two hours!

The score distribution will be as follows: $$$500-1000-1500-2000-2500-3000$$$.

This round would not be possible without the support of everyone behind this round:

Lastly, we thank MikeMirzayanov for creating the incredible Codeforces platform, where many of us have engaged in friendly competition, honed our problem-solving skills, and forged lasting friendships throughout the years!

From our keyboard to yours, we (and Penchick) wish you good luck, positive delta, and an exciting competition experience!

Note: There is at least one interactive problem, so please read the guide for interactive problems if you are unfamiliar with them.

UPD: Editorial has been posted, go check it out!

UPD: Congratulations to the winners!

Div. 1 + Div. 2:

  1. tourist, as expected, fully solving all problems in 53 minutes
  2. antontrygubO_o, who did so just 2 minutes later
  3. noimi
  4. A_G
  5. Pyqe
  6. StarSilk
  7. dyppp
  8. kotatsugame
  9. busamate
  10. tarjen

They, along with 8 other contestants, are the only AKers (full-solvers) in the whole contest!

Div. 2 only:

  1. LGlcx, who full-solved in 100 minutes!
  2. Sky_Maths
  3. G2Esports
  4. boboquack
  5. ac_de_taffy
  6. Jack.YT
  7. Alex2184
  8. MrPizza
  9. priyanshu.p
  10. CC_cccc

We hope you all enjoyed the round!

Want more of Penchick?
  • Проголосовать: нравится
  • +537
  • Проголосовать: не нравится

»
22 месяца назад, скрыть # |
Rev. 5  
Проголосовать: нравится +22 Проголосовать: не нравится

pwned orz!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +42 Проголосовать: не нравится

Omg “highschool CPers” CF round!!! Expecting an interesting problemset!!

»
22 месяца назад, скрыть # |
Rev. 2  
Проголосовать: нравится +13 Проголосовать: не нравится

:penchickpride: pwned orz!!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

:pinoypride: penchick pwned orz!!

»
22 месяца назад, скрыть # |
Rev. 3  
Проголосовать: нравится +13 Проголосовать: не нравится

I waddle for the fish!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

pwned orz!!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +36 Проголосовать: не нравится

As a taster, I found the problems very delicious

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

hi orz ppl @pwned @culver0412

i will definitely join! :penchickcheer:

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +64 Проголосовать: не нравится

As a tester, maomao90 is gay

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

As a setter, I'm surprised Penchick hasn't had jet lag yet.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

pwned orz

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

excited for penchick-pilled round !!!!! (pwned orz)

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

As a tester, I'll let you in on some facts:

Facts

GL&HR!

»
22 месяца назад, скрыть # |
Rev. 3  
Проголосовать: нравится +24 Проголосовать: не нравится

as a participant, here is an obligatory penchick image that nobody has posted yet

penchick-squak

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

After more than two years of preparation and nearly thirty problems on our shortlist

Couldn’t be more excited to get into this

images

»
22 месяца назад, скрыть # |
Rev. 2  
Проголосовать: нравится +11 Проголосовать: не нравится

Excited to participate, pwned amazing!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

As a tester W round

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

as someone giving their advice in creating interesting problems, please upvote

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

As a participant, I love Penchick!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

As a participant, I read all the comments and wondered why only one peng' has orange beak and why are the 2 rubik's cubes having 2 different "**shades of green**" ?!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

duckforces

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Hoping for the best Div.2 Round! Btw, the penguins are cute <3

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится

penguinforces

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

So excited,hope that the problems are as cute as the announcement and the penchicks.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +30 Проголосовать: не нравится

As a tester, good luck and

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Penguiiiiiiiiiins

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

"Why is there no Div 4? The last one was 1.5 months ago..."

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

You for being an awesome member of the CF community! The "You" of this sentence is surprising!!!!!!!!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

As a tester, after creating six problems for us, Penchick is now resting peacefully.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

i will get another positive contribution with this comment

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

As a participant, I am not a tester.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Hope to comeback CM after this round.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +22 Проголосовать: не нравится

omg NeroZein mentioned

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Masters Masters Everywhere.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I think "note the unusual time!" should be bold and large font like

note the unusual time!
»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

Oh,this Penchicks are so cute!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

As a tester, did I come late? I kept asking Penchick for the delicious feast and almost forgot the time for this round.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

Finally, a plush toys photo session in round announcement <3 Thanks, guys!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Penchick

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I'm back :)

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Very cute!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

what are penchicks?

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

very good unusual time, very scary interactive problem, like from porcelain

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

NO way C is a real problem

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +19 Проголосовать: не нравится

This is true SpeedForces.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

i choked really hard today. C is the worst C i ever met in a div 2 too

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

i just spent 30 minutes searching for a mistake just to discover that i wrote cerr instead of cout

»
22 месяца назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

is D a graph problem?

edit : can you give some hints

  • »
    »
    22 месяца назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Yes.

    • »
      »
      »
      22 месяца назад, скрыть # ^ |
       
      Проголосовать: нравится +8 Проголосовать: не нравится

      How did you solve it as a graph problem? I used

      spoiler
      • »
        »
        »
        »
        22 месяца назад, скрыть # ^ |
        Rev. 5  
        Проголосовать: нравится 0 Проголосовать: не нравится

        I used a segment tree can you share your logic

        • »
          »
          »
          »
          »
          22 месяца назад, скрыть # ^ |
           
          Проголосовать: нравится 0 Проголосовать: не нравится

          Can you explain your Solution

          • »
            »
            »
            »
            »
            »
            22 месяца назад, скрыть # ^ |
            Rev. 2  
            Проголосовать: нравится 0 Проголосовать: не нравится

            just as said in the problem you can travel to larger elements in the left

            so first i calculated the prefix maximum for the array this will tell you what is the largest element that you can travel if only first operation is allowed now i created a segment tree that can give maximum in any range of array , then traversed the array from right to left

            if i am at an index i what is the value that i can reach anything smaller in the left from 1, prefixmax[i]-1 (as going to the prefix maximum will increase the scope of traversal in left ans the result will be even larger) so just calculate the maximum for this modify answer[i] with max(query(1,prefix[i]-1),prefix[i])

        • »
          »
          »
          »
          »
          22 месяца назад, скрыть # ^ |
           
          Проголосовать: нравится 0 Проголосовать: не нравится
          Spoiler
    • »
      »
      »
      22 месяца назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      I used dsu and set. Iterate from left to right, and for current val, all the left side larger than the val should be connected with current val (and we can do this recursively with dsu.find).

  • »
    »
    22 месяца назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    At least my solution has nothing to do with graphs.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

plz provide enough test cases

  • »
    »
    22 месяца назад, скрыть # ^ |
     
    Проголосовать: нравится +11 Проголосовать: не нравится

    Sometimes there is a deliberate shortage of provided test cases since otherwise the pattern to the problem would be obvious. Few test cases often indicates you just need to find a pattern yourself by working through some examples.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

What is the solution for odd in C ?

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

what was the distribution technique for question 3rd... I thought of pairing in 2 because their difference will be 1 which is a perfect square but for odd N, i paired index 1 10 and 26 as their difference is also perfect sqaure.

Anyone ? whose solution got AC ? Thanks !!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is this correct for F? I was not able to submit it due to the fucking internet

My solution
»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Did thought about pythagorean triplet, and still choke at problem C.

Double the pain again.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

the B problem has an issue with python solution did you ever test it with python? i always get TLE

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I submitted E in the last 10s of the contest but unfortunately got WA.

Anybody got an idea why this got WA on pretest 23?

Code
»
22 месяца назад, скрыть # |
Rev. 6  
Проголосовать: нравится 0 Проголосовать: не нравится

Why does cpp23, cpp20 and cpp17 give different results for these solutions??

291657006 291656787 291655971

Code

nvm, overkilled it, realising it now that it could've been solved in a much more easier manner T_T

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I really thought I would end up screwing up this round because I spent way too long on B, but I pulled off C and D quickly enough :D

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Did anyone else get Runtime error pretest 61 on E? Sys tests aren't happening and the suspense is killing me T-T

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

My solution:

[D]

Observation1: note the maximum value as mx, and the number to the right of mx will definitely reach mx.

Observation2: if a[i]>min(mxpos,n), all a[i,...n] can reach mx.

So we can maintain a variable pos and continuously execute the following process:

pos=posmx initially.

  • find min i (1<=i<pos) such that a[i]>min(a[pos,...,n])

  • update pos:=i, or break if no such i

So we found a suffix that can reach mx. Then recursively solve the sub-problem.

[E]

Consider reverse operation: add nodes from the given tree to make it a perfect binary tree.

DP. Note dp[x] as the minimum depth at which subtree x becomes a perfect binary tree.

Observing the process of adding nodes (from leaves to roots) is actually a classic Huffman tree.

So we can use greed+priority queue to process dp [son[x][i]] to obtain dp[x].

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Why is there such an important change in E so much later into the contest??? I was already working on the solution according to the problem statement by then, trying to write this complicated re-rooting dp code, and after submitting towards the end of the contest notice this change. How is this fair?? Please make this contest unrated.

  • »
    »
    22 месяца назад, скрыть # ^ |
     
    Проголосовать: нравится +10 Проголосовать: не нравится

    The roots of the trees have always been well-defined in the statement. The binary tree is rooted by definition.

    The clarification was made to point this out, and didn't change the statement.

    • »
      »
      »
      22 месяца назад, скрыть # ^ |
       
      Проголосовать: нравится -19 Проголосовать: не нравится

      What do you understand from this statement — "Since Penchick and Chloe are good friends, Chloe wants her tree to be isomorphic to Penchick's tree"? I don't know why whould you change a well known definition for your convenience. Please make clear problem statements.

  • »
    »
    22 месяца назад, скрыть # ^ |
     
    Проголосовать: нравится +18 Проголосовать: не нравится

    Footnote 2: A full binary tree is rooted tree, in which each node has 0 or 2 children.

    Combined with

    Footnote 1: A rooted tree is a tree where one vertex is special and called the root. The parent of vertex v is the first vertex on the simple path from v to the root. The root has no parent. A child of vertex v is any vertex u for which v is the parent.

    Is sufficient to define that the root of the binary tree is the top-most vertex.

    The root of Penchick's tree is defined as 1 in the statement "... with vertex 1 as the root".

    In footnote 3, isomorphism of rooted tree is clearly specified "Two rooted trees, rooted at $$$r_1$$$ and $$$r_2$$$ respectively, are considered isomorphic if there exists a permutation $$$p$$$ of the vertices such that an edge $$$(u, v)$$$ exists in the first tree if and only if the edge $$$(p_u, p_v)$$$ exists in the second tree, and $$$r_1 = p_{r_2}$$$."

    Hence, there are no issues with the original statement.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

D can be solved with dsu. For each point, merge it with the point to the left of this point and with the highest height, and also merge it with the point to the right that is farthest away from it and with a height smaller than it. The answer corresponding to the set is maintained while merging. It can be shown that this merging is optimal.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is there any reason for the memory limit to be smaller than the size of the stack for max N in python? I had a very inelegant solution to D that failed due to stack not fitting the memory.

  • »
    »
    22 месяца назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Actually, there's no easy way to expand the stack size of Python on Windows, as the Python executable is already compiled with the default stack size (1MB, IIRC).

    • »
      »
      »
      22 месяца назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      eee you can, sys.setrecursionlimit(10**5) increases memory usage so I suppose also the stack limit, but with 256MB you can fit just about 10**5 and N is 5 times more in D.

      • »
        »
        »
        »
        22 месяца назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        That function increases the internal recursion limit, but it does not expand the stack size of Python runtime.

        For example, running the following code with custom invocation will give you a stack overflow error (both in PyPy and Python). This means Python can't handle recursion calls nested just 10000 times, which indirectly shows Python runtime's stack size remains small even if you call sys.setrecursionlimit.

        import sys
        N = 10_000
        sys.setrecursionlimit(N + 100)
        
        def f(n):
            if n == 0:
                return 0
            return f(n - 1) + n
        
        print(f(N))
        
»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

C and D were interesting

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

All problems here are bangers!! E is my favorite, but F is cool as well

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

comeback CM now (probably)

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

How is it that suddenly 2000+ people solved C problem in the last 20-30 mins? Hope the cheaters are found and removed!!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Will I get back to 1900 after rollback?

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

https://codeforces.me/contest/2031/submission/291676661

Can anyone let me know why my solution for B is wrong? I cannot find any edge case for this.

Please let me know why my solution is wrong, thank you very much

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

So many new accounts on top positions :(. One has to improve if they want to simply keep their rating (otherwise they will be in an equilibrium rating lower than their “true” rating. Maybe this is not a problem if the amount of Smurfs is constant between contests, but I feel like this one has quite a lot)

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Making $$$2 \le k \le n$$$ i.e., asking subsequence of length atleast $$$2$$$ will make the problem $$$F$$$ as troll D2C ig ;)

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Good contest, thanks.

Also the problem F is amazing.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Congrats to programpiggy for finally reaching M!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Thanks for the contest! Participated virtually. Love problem C!

»
21 месяц назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

There is a cheat alert sent to me says that my code is similar to other codes (about 12 or 13 person), I didn't do that but of course my code will be similar it's an idea and it's my implementation for it of course another person made the same. So please let me understand what's your point of view. finally sorry for inconvenience.

»
17 месяцев назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится