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

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

Hi Codeforces!

Talaodi, YunQian, xukai and I mazihang2022 are excited to invite everyone to participate in Codeforces Round 858 (Div. 2), which will be held on Mar/18/2023 15:05 (Moscow time). Please note the unusual start time.

This round will be rated for participants with rating lower than 2100. We will be pleased to see the participants with a higher rating to take part in our round unofficially as well!

You will be given 6 problems to solve, one of which contains subtasks. You will have 2 hours and 15 minutes to solve them. Scoring distribution will be announced later.

We would like to thank everyone who helped with this round:

We are looking forward to your participation. Good luck and Have fun!

UPD1: Score distribution: $$$500-1000-1750-2000-2250-(2500+1500)$$$

UPD2: Editorial

UPD3: Congratulations to the winners!

Official winners:

  1. MoFalkmusic
  2. Goldenglowo
  3. 2021_yes
  4. Terry2022
  5. gajar.nouka

Unofficial winners:

  1. BucketPotato
  2. MoFalkmusic
  3. Goldenglowo
  4. tute7627
  5. 2021_yes
  • Проголосовать: нравится
  • +70
  • Проголосовать: не нравится

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

as the mascot, give me contribution!

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

As a tester, I liked to test this round, and hope you will have fun participating :)

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

As a grey tester I can say that div3 div4 participants will like the round.
Glhf!

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

As a tester, I hope you enjoy the problems as much as I did.

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

    Tomorrow is the birthday of my most beloved and only uncle. I want to congratulate him on the gift and good deltas after the contest!

    milind0110 orz!

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

As a tester, I enjoyed testing the round. Good luck to participants!

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

My first contest as an expert. Definitely not dropping back to specialist

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

Perfect time for Chinese people

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

As a tester, I must say that this contest has a problem that got into my favorite problems list. You should definitely participate in it.

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

As a user, this contest is one of the codeforces contests.

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

As GPT-4, I will be participating in this Round :) Get Ready Humans.

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

    I'll focus on your performance.

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

    Division 2 is still hard for GPT. What's funny is that GPT is eager to solve hard problems than problem A. For example having a potential solution for problem E which got finally TLE, than coming up with some basic logic for problem A. P.S. I wasn't able to use GPT-4 all the time, even with the paid subscription, it's still limited to 25 requests per 3 hours, LoL...

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

    Got positive delta at least :)

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

first time a round in which I know so many testers :hype:

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

what can be reason to increase contest duration by 15 minutes than usual 2 hour duration ?

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

As a contestant, I anticipate this Chinese Round to be great one seeing the authors!

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

Hope to become master again!..

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

ooh there are a contest again...i feel i have got long time without any contest ... ....actually when you get hacked in two consecutive contest you will need more contests to get your lost point again . i hope ,i have no hacked problems in this contest :)

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

I wish I could do well in this div

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

CN round, rating recycling round

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

    HOW DO YOUR E'S SOLUTION WORK? I GET 10* TLE ON 10 NOW! TERRIBLE!

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

OH,a bad time for me QWQ

»
14 месяцев назад, # |
Rev. 2   Проголосовать: нравится -7 Проголосовать: не нравится

damn Dominater069 & milind0110 as testers But VIP tester must be Codula

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

18o3 orz

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

omg subtask for problem F round

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

Another round with problem C of 1750 score

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

Hope rating ++ in Chinese rounds! Good luck!

»
14 месяцев назад, # |
  Проголосовать: нравится +46 Проголосовать: не нравится
My predictions to this contest
»
14 месяцев назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

Hope rating++

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

good luck!

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

WOW the score distribution...

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

Good luck everybody!Hopefully i will become pupil again.

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

Masterforces!

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

I think I am going to have fun after solving A,B good luck in C am not interested :D

»
14 месяцев назад, # |
Rev. 4   Проголосовать: нравится +1 Проголосовать: не нравится

speedforces is back !

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

Now, this was completely opposite to today's Mathura ICPC prelims. :(
Tooooo Tough.

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

Hardest div2 C ever :)

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

I saw names of all problems , ans i was like.....isn't it masters' round?!?!?! :)

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

I can't solve Problem.B :(

and I will 掉大分

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

C hurts :(

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

Dumbest C ever lol. So many cases

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

I couldn't even solve the subtask for C, generating any array that satisfies the condition, let alone a minimum distance one. All I could think of was an array of all 0's.

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

Let's face it. I solved D by finding patterns using pure brute force. I don't even know what the hell this problem is all about. But i passed it:)

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

    orz

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

    I think you are the luckiest person on the planet for a moment.Can you describe how you have done.

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

      I observed the sample and found that 2=1*2, 7=2*3+1, 31=7*4+3, 167=31*5+12, 1002=167*6, 7314=1002*7+300, 60612=7314*8+2100. Then I found the pattern of the number behind.

      However, it is not correct at first, so I wrote a brute force program:

      Code

      I found about the 0 cases and finally developed the right pattern. When I finished testing, i got pretest passed.

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

How C & E?

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

I like problem D, thanks.

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

I think we should exchange D and E

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

Hooooooow toooooooo sooooolllllllllvvvvvvveeeeeeeee EEEEEEEEEEEEE TwT too hard

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

I'm not sure if i understood C wrong, depending on what i have understood the output in sample 3,4 is impossible. that was a mind F*** for me. from what i understood this condition should be met the product of n elements of the array must equal the sum of the same n elements because we should exclude and include the same elements but HOW. it's either 4 elements 2 2 2 2 or if it's more i didnt find other than array filled with zeros. im sure there is a usage for negative and positive numbers bullshit but couldnt find it

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

How to solve C? I went through all possible patterns but still WA.

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

    if n is not odd then [-1,-1,-1...,-1,n] works otherwise [0,0,0...] is one possible solution for all arrays. You also need to take care of corner cases for n==1 and n==2. For n==2, [2,2,2,2] works.

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

I had a stroke trying to comprehend the problem statement of D. The entire time I solved a completely different problem because I misunderstood the task

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

can someone tell me why my approach for B isn't right all i did was count the no of zeros and non zero elements . by this i made sure if i can't make all zeros disappear i'll take the smallest non zero element as answer

 if(cntzero == 0 )
        {
        	out.println(0);
        }
        else if(cntnon_zero == 0)
        {
            out.println(1);
        }
        else if( cntzero-cntnonzero > 1)
        {
            out.println(min(non_zero);
        }
        else if(cntzero-cntononzero <= 1)
        {
        	out.println(0);
        }        
  • »
    »
    14 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    the smallest non zero element as answer

    But if you have numbers 0 3 0 0, then clearly answer is 1, not 3.

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

Nice contest, I liked all tasks I tried (A, B, C, E)

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

Seems like Mo's algorithm was not enough for E (at least for me).

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

One of the toughest Div2 for me.

Anyone, please help me in B?

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

    if the number of zeros is <= the number of notZeros+1, you can arrange them (for example) like this: 0 2 0 7 0 2 0 5 0... Here, all the sums of adjacent numbers are >0, therefore, you can pick 0

    else if the greatest number is greater than 1, you can arrange it like this: 0 0 0 0 0 7 5 2 2 (there is a sequence of 0s and then the other numbers are sorted backwards) Here, all the sums of adjacent numbers will never be 1, therefore you can pick 1

    if the greatest number is 1, you can arrange it like this: 0 0 0 1 0 0 1 0 1 (where no 1's are adjacent) Here, all the sums of adjacent numbers are either 0 or 1, therefore you can pick 2

    if the greatest number is 0, you can obviously just pick 1

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

In problem D Can someone explain why p=[2,1] and a=[0,1] has score 1?

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

For D, I don't think the answer for case
3
0 1
is 2. for p = {1, 2} we have 2->1->3, and {2, 1} we have 3->2<-1. The total sum of vertex 1's incoming edges is 1.Yet in the case 2 the answer is
1 2 7 31 167 1002 7314 60612
for case
9
0 1 0 0 0 1 0 0
when k = 2 the answer is 2 instead of 1. Why is that?

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

How to solve F1?

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

I had to generate all possible sequence to figure out the last sample of C.

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

My first contest as a specialist!
Definitely not dropping back to pupil!

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

    you can try CF-Predictor on Chrome to get the estimated rating changing

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

Can anyone share some thought for problem E?

What I did in the contest was:

  1. Set a constant B

  2. Compute DP-ish the answer of all f(u, v) when the number of the vertices in that depth is <= B, compute additional answer when needed.

  3. Do the same as in query.

I thought the complexity should be like O(n^(3/2)) when B ~ n^(1/2). Got a TLE though.

Was there a O(n log(n)) or O(n) answer? I was also thinking about some smart way to precompute stuff, but didn't come out with one.

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

    There is a Mo's Algorithm on Trees solution, you can check this blog if you are not familiar with the algorithm.

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

What the fuck is the brute force solution of E with just memorizing the queries getting pretests passed?

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

    how? i have tried using both map and unordered_map but failed.

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

    What's wrong with that?

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

    It can be proved that the complexity of it is O(n*sqrt(n)).

    Consider the set of vertices of the same depth. We call Si as the set of depth i. If the size of Si is below sqrt(n), then we can calculate the answer of each pair in it using the answer of Si-1. Otherwise, we ignore it. Because the size of Si is below sqrt(n), the size of the set of their parents is below sqrt(n), too. So, we can calculate the answer of each pair of their parents. You will find that you calculate the answer of min(sqrt(n),size)^2 pairs in one depth, so the complexity of it is O(n*sqrt(n)).

    When we answer a question of (x,y), let i be the depth of them. If the size of Si is below sqrt(n), we can use the answer that we have calculated. Otherwise, we use brute force algorithm until we find the answer of (x,y) is calculated. You will find that the process will happen only if the size of Si is above sqrt(n). The number of those i is below sqrt(n), so we do this process at most sqrt(n) times in one query.

    You will find that the brute force solution of E with just memorizing the queries is the same as my algorithm.

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

Am i true that E is sqrt decomposition?

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

Approach for C :

if n is 1 then just abs(p[0] — p[1]) else if n is 2 then consider {2, 2, 2, 2} and {2, -1, -1, -1} else if n is even then consider {n, -1, -1, -1 ... (2n — 1) times}

I don't know the proof :(

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

Awful contest. The letter number of problems should be A-C-D-F-E-G1-G2. How did testers test this contest?

Solved A-C and E. Maybe I could solve D if I've consumed less time on some wrong approaches of E, but I don't have enough time for it.

A: The number of first operation (+1, +1) is d-b, and second operation (-1, 0) is a+d-b-c. The answer is their sum if both are non-negative.

B: Let c0=count of zeros in the array. Then if c0<=floor(n/2), we can arrange numbers such that every 2 occurences of zero are non-adjacent, then every pair of adjacent numbers will have positive sum, so MEX=0. Otherwise, we could put zeros on the left and other number on the right, if there's some number >=2, we put it on the boundary of zeros and positive numbers, so every non-zero sums will be >=2, so MEX=1. Otherwise, there are only 0 and 1 in the array, and because the count of zeros is strictly more than ones, we can arrange them like 01010...0100...00, then MEX=2.

C: By brute force for n<=4 we can conjecture that:

  • if n=1, good arrays are [a, a] where a can be any integer.

  • if n=2, good arrays are [0, 0, 0, 0], [2, 2, 2, 2], [-1, -1, -1, 2] (and its permutations).

  • if n>2 and n is odd, only [0, ..., 0] is good array.

  • if n>2 and n is even, good arrays are [0, ..., 0] and [-1, -1, ..., -1, n] (and its permutations).

E: Mo's algorithm on tree. For each depth d we need to record nodes with depth d on the current path, and if there are 2 nodes (u, v) with depth d, they contribute a[u]*a[v] to the answer. And we need to add dp[lca(x, y)] for each query additionally, where dp[i] is the sum of a[j]^2 over all nodes on the path from 1 to i.

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

    For C:

    If $$$n=2$$$, why $$$[-1,-2,-1,3]$$$ isn't good array?

    If $$$n=3$$$, why $$$[0,x,-x,0,-x,x]$$$ isn't good array?

    Have I misunderstood the meaning of good?

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

    Hi just wanted to give my perspective as a tester

    i solved abcde however c got changed and i solved the new c too in 20mins.

    for C : there is really cute algebra solution, no need of bruteforce; first take any random set S1 and its complement S2, write equation, swap one element from S1 with one element from S2

    Rewrite the equation, and cancel variables, you will easily get the necessary stuff

    D : this problem has a complicated statement but i didnt expect it to become this hard. Quite a few testers solved it and most upsolved it atleast.

    E : this problem also has a neat sqrt solution, you can check my submission

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

В русском условии задачи D написано:

Заметим, что после каждого шага можно показать, что каждая компонента слабой связности G имеет единственную вершину с единственным входящим ребром.

В английской же версии написано по-другому:

Note that after each step, it can be proven that each weakly connected component of G has a unique vertex with only incoming edges.

Кажется, что две этих надписи имеют разный смысл — в английской версии четко сказано про сток, в русской же рассматривается вершина, в которую входит ровно одно ребро.

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

problem C was harder than usually, even two last examples were unclear for me

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

wtf..

Can anyone explain the solution for Problem C..

was it at all a constructive or observation based Problem too?..

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

Can someone please explain why am I getting MLE in A? Submission: 197908525

This works perfectly fine in 256MB, so why would it give MLE with a higher memory limit?

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

score = -roundNumber

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

problems are a bit more difficult than div2 before.

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

waiting for editorial

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

thanks for contest!!!this contest's C is harder than normal div2 C.F1 and F2 is excellent problem.

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

I had submitted my answer for problem B and it got accepted but now it is showing in queue . please fix it.

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

As a participant, akash bhora tara........:)

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

please rejudge https://codeforces.com/contest/1806/submission/197938565, test 25 is pretest but i can't pass it in maintest.

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

My brute force solution for E got passed. submission: 197969099 The approach is: for every query (x,y) with depth d, brute force the first sqrt(n) pairs. Then memorize the rest d-sqrt(n) pairs. Unfortunately, I don't know how to prove or disprove it.

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

unordered_map is so slow that I got TLE in problem E.

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

    I mean I got TLE with map.

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

      i'm so sad , i know it can be solved by hash ,and tried with unordered map i'v tried lots of times but TLE which waste my time and i know i may pass it if i write a hash instead of using STL at the last 3 minutes

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

Problem C is a very interesting constructive problem.

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

excuse me, for problem C what is the answer of this input? " 1 3 1 2 3 1 2 3 "

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

I tried to read D after contest and couldnt understand the statement. So i asked someone to explain it to me, only to then notice that they also didn't understand the statement, lol.

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

    So how can the statement be improved while being understandable for someone who does not know of DSU while not being ambiguous?

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

      I think it would help if the statement was worded in a way that gave a more intuitive idea of what is happening.

      For example, you could first say that the leader of a vertex is the vertex in its weakly connected component with no outgoing edges, and then say that the match will go out between $$$leader(p_i)$$$ and $$$leader(p_{i+1})$$$.

      This way you show that $$$u$$$ and $$$v$$$ are a function of $$$p_i$$$ (which is important because at that point they could be 2 numbers that are given on input) and there is an intuitive interpretation of "leader" that can make you understand the statement even if something is unclear to you

      You could also drop the graph definition entirely and go 100% ludical, for example by saying that when leader $$$a$$$ wins a game against another leader $$$b$$$, $$$a$$$ becomes the leader of $$$b$$$ as well as all the people that $$$b$$$ was a leader of, and then define which games would happen based on the $$$a$$$ and $$$p$$$ sequences.

      Another thing that would certainly help was if the animated gif explaining the problem had a bigger example, what is happening is still very ambiguous even when looking at it.

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

        You could also drop the graph definition entirely and go 100% ludical, for example by saying that when leader a wins a game against another leader b, a becomes the leader of b as well as all the people that b was a leader of, and then define which games would happen based on the a and p sequences.

        I actually wanted to to with this.

        alternate statement draft

        But testers did not like because they claimed the current statement does not look like a mess of random operations.

        Regarding the part about intuitiveness, I thought the title was a big hint into what the process was doing as we tried to explain DSU process in the most concise way possible.

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

          Well, a lot of problems with topics on the title tend to have nothing to do with that topic so I typically don't consider that.

          Anyways I also don't like that draft as well. I think the core problem is that the operations do have a very pretty and intuitive interpretation but it is hard to decode from the statement (someone is the leader of a group and if they win the game they become the leader of the group they won against).

          For example, this was what that person that explained the problem to me said:

          Spoiler

          Even though there is little to no mathematical rigor (and technically being wrong, as they also missed that it was the sum for 1 and not the overall winner), it helped me looking at the definitions of the original statement and saying stuff like "ahhh, that's why we have a permutation here" and "it makes sense now that we care about the vertice with no outgoing edges".

          Just to be clear, I don't think that example should be the statement of the problem verbatim. However I think adding flavor text to problems like this helps a lot. That's why a lot of statements say stuff like "We're doing X. Formally, we will have Y." Instead of just saying the mathematical definition head on.

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

If someone is interested, I have explained my $$$O\left(n \cdot q\right)$$$ solution for problem 1806E - Tree Master in this comment under the editorial.

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

Problem E is exactly the same as this problem.

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

I think the solution of E is a little rigid.But we can still learn something good from the contest.

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

You are wrong.Here is why.

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

You don't need to control the constant for problem E, you can set the threshold to around 100, and you can run fast.
Here