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

Автор StarSilk, история, 2 дня назад, По-английски

Hi Codeforces!

As the Chinese New Year approaches, we are glad to invite you to our Codeforces Round Ethflow Round 1 (Codeforces Round 1001, Div. 1 + Div. 2) which will be held on Jan/26/2025 17:35 (Moscow time). You will be presented with $$$8$$$ problems, one of which is divided into two subtasks, and $$$2.5$$$ hours to solve them. This round will be rated for all participants.

This round is the first Div. 1 + Div. 2 round on Codeforces with a four-digit round number, and it is also my first round. We hope you will enjoy this round.

Great thanks to:

Good luck & Have fun!

upd1: The score distribution is as follows: $$$500 - 1000 - 1000 - 2000 - (1500 + 2500) - 3500 - 4000 - 4500$$$

A few words from our sponsor:

Hello, Codeforces!

We are Ethflow, a proprietary trading fund specializing in cryptocurrency trading, and we’re glad to host our first Codeforces round!

Participants will have a chance to win T-shirts:

  • The top 50 ranked competitors.
  • 50 random participants who solve at least 3 problems and rank below 50th place.

Our team includes Codeforces grandmasters, IOI/IMO medalists, and ICPC Finals competitors. At Ethflow, we value people and create an environment where you can focus on challenges you enjoy, exploring everything from infrastructure to analytics without toxic practices. To join our team, please fill out the form.

Good luck to all participants!

upd2: Editorial

Congratulations to the winners!

  1. orzdevinwang
  2. ksun48
  3. tourist
  4. squareOf105
  5. potato167
  • Проголосовать: нравится
  • +202
  • Проголосовать: не нравится

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

As a writer, it's the second round I put in a lot of effort to. Let's see if jiangly can keep jiangly as he has registered.

Besides, I have prepared another mysterious mission. If anyone solves it, share it!

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

As a tester...I met StarSilk during the EC-Final and found he is a little white cute cat( = · ω · = ) and I'm very appreciate to the problems in this round created by StarSilk , SSerxhs and Yakumo_Ran.Hope every participant enjoy this round!

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

As a tester, I recommend to invest bitcoin instead of ethereum :)

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

As a tester, it's my pleasure to enjoy such miaomiao problems. Hope u enjoy them, too.

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

Hope to meet a perfect game on the 1001st night

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

As a tester, I think this match is fantastic, and I hope everyone can enjoy these meowmeow questions( = · ω · = ).

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

As a participant $$$1001$$$ is the first $$$4$$$-digit palindrome.

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

As a participant, I can confirm that $$$1001$$$ is a composite.

»
47 часов назад, # |
  Проголосовать: нравится +38 Проголосовать: не нравится

As a tester, I confirm that StarSilk is a cat.

»
47 часов назад, # |
Rev. 2   Проголосовать: нравится +17 Проголосовать: не нравится

as participant i will share you a fact for fun, if you write a number n>=100 and n<=999 and write the same number to it's exactly right, then the new 6 digit number formed will be divisible by 1001.

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

As a tester, hope every participant enjoy the 'SSSS round' authored by StarSilk,SSerxhs and Yakumo_Ran. :)

Thanks for providing amazing problems for all Codeforcers.

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

As a participant, i hope i can gain non negative delta

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

HOPE TO GET POSITIVE DELTA

»
42 часа назад, # |
  Проголосовать: нравится -13 Проголосовать: не нравится

i want tourist became again tourist

»
39 часов назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

As a tester, I can finally say that I TESTED. Really good contest, I hope everyone gets positive delta.

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

Wishing everyone +Δ on Round 7*11*13! :)

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

As a participant, I can confirm that 1001 is the product of 3 consecutive primes!

»
36 часов назад, # |
  Проголосовать: нравится -18 Проголосовать: не нравится

as a green green plant, give me rating!

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

Score Distribution.

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

Those who surpass 4000 will be awarded a badge with their name???

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

Wishing everyone a Positive Delta <3

Hope i Get to Pupil this time.

A better Score Distribution needed :p

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

Score distribution ???

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

palindrome round )

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

Score distrib => Speedforces?

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

I hope to become CM in this contest.

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

Another Speedforces round ! :(

»
24 часа назад, # |
  Проголосовать: нравится -18 Проголосовать: не нравится

there is a problem with rating (1500 + 2000 ) .. I understand that it will have 2 parts , easy version and hard version but is 1500 rating for this problem easier than the problem before that which has rating of 2000

I am asking this because I have seen such difficulty ratings in previous competitions but still solves for that lower rated problem ( which is easier version of some harder problem ) is generally lower than an earlier problem which can be more rated

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

    As far as I know, yes, it will (or should, as the scores are not always accurate) be easier. That's probably because most participants try to solve the problems in order (this also affects the problem difficulty afterwards, which might explain why the difficulties are usually increasing even when the scores are not).

    Also note that (since someone always asks this in contest announcements) that the hard version's actual score (its score if it was a single problem without subtasks) is 3500 (1500+2000), not 2000.

    • »
      »
      »
      24 часа назад, # ^ |
        Проголосовать: нравится +5 Проголосовать: не нравится

      thank you for the insight,

      this will help me plan how I do the problems. I will peek at that lower-rated problem once before I spend time on an earlier higher-rated one

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

        could you please explain should i attempt the 1500 one before or the 2000 one

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

          Well, the 1500 one is easier. On the other hand, the score of problems worth more points decreases faster that problems worth less.

          Personally, I just solve them in order, but that's probably not be the best strategy.

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

          Since speed is the most important thing, you should look at both and solve whichever one you can do faster first (which is what I did, and solved E1 before D).

      • »
        »
        »
        »
        24 часа назад, # ^ |
          Проголосовать: нравится +9 Проголосовать: не нравится

        That might be a good idea (I've planned to do that before, but usually stick to the actual order, though).

        Anyway, my advise: always have the number of solves in mind, and, if you can't solve a problem, check the next one.

        There are cases of contests where earlier problems worth less points are harder than later ones, and you might waste time on a harder problem if you don't notice the difference in the number of solves. Also, sometimes, a problem that's hard for most people might be easy for you, especially if it's based on a topic you're good at.

        Of course, you should also remember that the number of solves might be affected by other things, like in problems with subtasks.

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

          thank you so much for your insights, this will definitely help me.

          I think I need to work on my strategy also along with DSA, LOL

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

            To be honest, I don't have a specific strtegy for CF contests, just lessons I learned by participating, like this. Just practice and even if you participate without a specific plan, your rating will grow.

            That's also true for OIs, even what I consider my "strategy" isn't something I conciously do, just something I realised I do.

            Besides, different strategies work for different people.

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

Guess who is ready to paint its name for a new look(hopefully non-green).

»
24 часа назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

As a participant, 1001 is a symbol of New beginnings and Self growth;

»
23 часа назад, # |
Rev. 2   Проголосовать: нравится +8 Проголосовать: не нравится

glhf xD

»
23 часа назад, # |
  Проголосовать: нравится -28 Проголосовать: не нравится

As a contestant, I really think StarSilk is a cat

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

I am unable to register in some contests including this one. What is the problem

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

I forgot to register sadly and i had to start 10 minutes lates and then i totally overcomplicated B. Maybe today was not my day.

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

unfortunately jiangly has to lose his title soon

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

how to do DIV 2D?

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

B,C were weird (not in a bad way) but actually really easy if you think simple. I wonder how GPT did on this contest.

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

    by mistake

  • »
    »
    20 часов назад, # ^ |
    Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

    how did you solve C? I was searching for my soul while thinking of ways. Also it'd be great if you could explain your thought process leading to any observation

    • »
      »
      »
      20 часов назад, # ^ |
        Проголосовать: нравится +4 Проголосовать: не нравится

      Plain brute Force!

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

        At every step we can have 2 choice, do diff OR do reverse and diff OR (current sum though this doesn't require an extra step). that leads to 2^49 possibilities in BF. So how did you applied BF? I guess it must be some better observation on which you did BF.

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

      n<=50 , brute force it first check diffrence sum if you dont reverse the array lets say its X then reverse the array and check diffrence sum Y if X>Y assign cur_array= array wihout reverse else cur_array = diff_array (after reversing) untill array length becomes 1 keep track of ans=max(ans,max(X,Y))

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

        what's the intuition/proof that this works??

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

          we can also write a recursive function and everytime make two list first containing diff list of the origal list in accending order and another considering it decending and just call the fuction again and again....

          at last use hashset to avoid precomputations also every time we need to conside the the current sum as well.

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

      think of vector operation

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

      You brute force all possible difference arrays and take the maximum of the absolute value of the sum of each array. It can be shown that the absolute value of the nth difference array is always the same. Code

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

      For the current vector a, you could choose replace the sequence with its difference sequence OR reverse it before replacing. However, the result in those 2 cases is just opposite signs, ans1 = -ans2 Therefore, just take care of replacing the sequence by using backtracking

    • »
      »
      »
      20 часов назад, # ^ |
      Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

      There are at most 2(n-1) operations you can meaningfully do, so if you found a strategy to optimally choose one or two operations at each step without backtracking, in O(n) time, the problem would admit an O(n^2) solution which passes given the lax input constraints. Since reversing more than once doesn't make sense, the sequence of operations boils down to an sequence of operation (2) with at most one reversal operation between each op 2. Reversing at the end doesn't make sense because it doesn't change the sum. Anyway, I solved it greedily by checking if reversing then differentiating is better than just differentiating, and leaving the sequence that got you the larger sum on each step. In the end, you output the largest sum you got at any point.

      Note: this can obviously be optimized taking the nature of the operations themselves into account, but you don't have to optimize anything to get AC.

    • »
      »
      »
      20 часов назад, # ^ |
        Проголосовать: нравится +13 Проголосовать: не нравится

      Here was my thought process:

      Started with a naive solution (recursion): At each step, we can do one of three things: - Accept the current sum and stop the process - Reverse the array - Replace the array with its diff (as explained in the problem statement).

      This worked, but is super slow, so let's see how we can optimise it.

      First observation, since the length of the input array is 50, we can replace the array with its diff at most 49 times (specifically, at most n-1 times), after that, we can no longer make any move.

      Second observation, reversing the array twice consecutively is worthless, as it will have no effect on the result.

      From these observation we conclude that we are looking for a sequence of operations such that there is never 2 consecutive reversing, and no more than n-1 diff operations. So it should look something like this: [R,D,D,D,R,D,...] (R for reverse, D for diff).

      Notice that an R must be followed by a D.

      Now notice the following: Say we have an array [a1, a2, a3, a4], if we do diff directly, we get [a2-a1, a3-a2, a4-a3], if we do reverse followed by diff, we get [a3-a4,a2-a3,a1-a2].

      What do you notice? We got the same elements, but multiplied by -1.

      It means that if doing diff eventually gives us a solution X, then doing reverse then diff should give us a solution -X.

      So now we can reduce the recursion complexity a lot, because we only need to discover one of the two branches, the opposite branch is just -1 * the first one.

      Thus, we can simply do the following: At each step, check the current sum, then compute the diff and do recursion to get a return R. Finally, return max(sum, abs(R)).

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

carrot extension is not working anymore?

»
20 часов назад, # |
  Проголосовать: нравится -10 Проголосовать: не нравится

so where is the solution?

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

My screencast (in Rust) will be available once it ends uploading

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

Finally got master!

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

E1 is really nice for both the idea and the implementation(although my one may be complicated).

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

Guessforces. So helpless when coding.

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

F is cool

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

Why guessforces???

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

Why 2.5 hours?

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

for A and C I couldn't make any observation so for A I just simulated greedily and for C I just assumed that there is no point in reversing twice ( no proof , but my pretests passed )

now I hope for good results

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

    although I later realized that for A you can just count number of 1s .. NOOOOOO !!!

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

Why do you not use Alice and Bob? If you are going to use dumb names with no relevance that make the problem harder to understand, at least try to not swap the gender in the middle of the statement.

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

Why there is not hacking phase? I mean after contest there should be 12 hour hacking phase right ?

»
20 часов назад, # |
Rev. 4   Проголосовать: нравится +42 Проголосовать: не нравится

A: Answer is simply initial count of '1'

B: Answer is true if and only if a[i]>2*max(i, n-1-i) for all 0<=i<=n-1

C: Do operation 2 and pick the absolute value of sum(a[i]) at this moment, as a candidate answer. Repeat until length of a[i] become 1. The initial sum is also a candidate answer

D: Assume a[i] has been decided, then the answer is sum(max(0, a[u]-a[parent(u)])), where a[parent(u)]=0 when u is the root. Then we can find the answer simply by dp

E1: For any node u, if there's any other node v such that v is not in subtree of u, and w[v]>w[u], we call u "good node". Then any good node with maximum w[u] could be the answer.

F: Sort all pairs such that for all 0<=i<n-1, we have (a[i]-b[i]<a[i+1]-b[i+1]) or (a[i]-b[i]==a[i+1]-b[i+1] and a[i]<=a[i+1]). Then candidate answers will be:

  • maximum value of b[i]+a[j]+ sum(a[t]+b[t]) (i<j, sum over several t (possibly none) with i<t<j)

  • maximum value of 2*b[i]+a[j1]+a[j2] + sum(a[t]+b[t]) (i<j1<j2, sum over several t (possibly none) with i<t<j2 and t!=j1)

  • maximum value of b[i1]+b[i2]+2*a[j] + sum(a[t]+b[t]) (i1<i2<j, sum over several t (possibly none) with i1<t<j and t!=i2)

  • maximum value of 2*b[i1]+a[j1]+b[i2]+2*a[j2] + sum(a[t]+b[t]) (i1<j1<i2<j2, sum over several t (possibly none) with i1<t<j2 and t!=i2 and t!=j1)

We can find the answer by simple DP.

  • »
    »
    20 часов назад, # ^ |
      Проголосовать: нравится -10 Проголосовать: не нравится

    Sir , Can we do D with binary search ?

  • »
    »
    19 часов назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится

    Please post this editorial every round

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

    What is mathematical proof behind C ?

    Also, E2, did you try thinking with PST ( persistent segment tree ? ). I had an approach, but code would be horrible. I don't know if my approach would work or not.

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

Interesting problem C, enjoyed the contest thoroughly

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

thanks for the problems. They were indeed enjoyable.

D absolutely killed me taking > 1 hr on it, but I was fast on F so fortunately my rating is saved at least.

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

50 random participants who solve at least 3 problems and rank below 50th place.

I should have figured out earlier why the count was set to 3 problems.. The steep rating change between C and D broke my soul !!

Indeed a SPEEDFORCES Round..

»
20 часов назад, # |
Rev. 2   Проголосовать: нравится +21 Проголосовать: не нравится

What I did in the contest:

Guess A, then passed.

Guess B and passed.

Guess D and get WA.

Guess C and passed.

Guess D for another solution and passed.

Guess E1 and passed.

The contest end.

What a terrible experience!

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

    What did u Guess in C..?

  • »
    »
    19 часов назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

    The proof for C is this: Let $$$r$$$ be reversing, $$$d$$$ be taking difference, and $$$1$$$ be the identity operation. Then it is easy to see $$$rdr = -d$$$ and $$$r^2=1$$$. So any sequence of $$$r$$$ and $$$d$$$ can be converted to a canonical form $$$r^i d^j$$$ where $$$i\in{0,1}$$$.

    And for the reverse direction, any $$$d^n$$$ can be converted to $$$-d^n$$$ via either $$$rd^nr$$$ or $$$rd^{n-1}rd$$$, depending on the parity of n.

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

    I did proove for B, rest of it i just guessed too, i dont know if it just me , but it feels annoying to give 2.5hrs and get nothing of it and also its so unsatisfying to guess and pass

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

This contest is just like my life. Fucked me up. [EDIT: Removed an asked question.]

»
20 часов назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

Great contest!

Loved the problem statements and the ideas.

  • A was cute: find a nice small observation.
  • B made me think a bit: was a bit slow with figuring the intervals idea.
  • C was a bit blant, probably, as most problems where you need to write some arithmetic expression.
  • D puzzled me and I didn't even figure the idea.
  • E1 made me think a lot and I loved the problem. Unfortunately, I was just 2 mins short before completing the code :( Also, right now I don't really understand the 4s time constraint.

Nice!

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

    For E1, I used Euler Tour and Segment Tree, and it took a little over 1 second. I heard that the intended solution needs to be in half the time limit, so 4 seconds works. 2 seconds would make intended solutions TLE I believe.

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

Did anyone else not realize that you needed longs for problem C?

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

guessforces!

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

really want an upovte? and please editorial??

»
20 часов назад, # |
  Проголосовать: нравится -10 Проголосовать: не нравится

D why

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

I have complited A,B,C in 40 min but i again submited C after 2hours (using different lang) which of my solution will be considered for evalution and which time of submittion will be taken 1st or 2nd

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

anyone solved E1 using small to large ?

»
19 часов назад, # |
  Проголосовать: нравится -45 Проголосовать: не нравится

This problems are so bad

»
19 часов назад, # |
  Проголосовать: нравится -40 Проголосовать: не нравится

A terrible round, thank you

»
19 часов назад, # |
  Проголосовать: нравится +46 Проголосовать: не нравится

probably just me, but why did D and E both have to be tree problems

»
19 часов назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

Treeforces (and I liked it)

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

please dont make monkey problems like A

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

D was very challenging for me can someone explain the main idea in very few words please

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

    Don't know if it is theoretically correct but passed the test. So record all the leaf nodes (in a queue). Notice that a leaf node can always increment itself, so if its parent node can have a higher value (i.e. upper bound of the parent is bigger than the lower bound of the leaf), then no need to worry (we can remove that leaf). Otherwise, the remaining tree (the whole tree except the leaf) must be incremented to match that leaf. However, no need to go and increment each node by a value, because the difference between each node in the remaining tree stays the same. Just increment that offset in an external variable. Then delete that node from the leaf queue. Once a nonleaf node becomes a leaf, push it into the queue. Repeat until only 1 node is left.

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

      Of course, the bond needs to be adjusted. i.e. the parent's lower bound shouldn't be smaller than the leaf's lower bound in case 1. In case 2, the parent's lower bound should be set to the highest it can be(match the upper bound of itself).

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

        hmm interesting approach, thank you ! I was thinking of all sort of weird stuff but couldnt find anything that could even pass the first pretest !

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

Where editorial?

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

Can't figure out C then guess it in same way like many others have done.... Still get wrong ans on test case 2 ... Can anyone tell me why this fail.... Same logic many other have passed it

My soln

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

jiangly may lose his title due to this contest

»
18 часов назад, # |
  Проголосовать: нравится +35 Проголосовать: не нравится

Thanks for the nice contest! I definitely had a good start, and I think mainly due to a fast start I got my LGM! Then I got stuck on the other problems, but they were fun to think about. My experience with the problems:

  • A: funny. I think it's the first time I've had a 0:00
  • B: Fun to find some conditions and see that they are necessary and sufficient.
  • C: Pretty fun, felt easy to me, but maybe it is luck.
  • D: I wanted to be fast, so didn't rigorously prove it. Felt quite hard, and I felt I was slow on it, although implementation was easy. Turns out I was not slow.
  • E1: Ok problem, indeed a bit easier than D.
  • E2: have some ideas of how to solve, but they were all quite cumbersome. I think it's mostly a DS problem, but it seems quite a nice one, it's not easily killed with some bash it seems.
  • F: Nice problem, I liked my geometric interpretation a lot, and the DP was not bad to write.
  • G: Maybe not a problem I would like, but there was enough other things to try. I didn't spend any time on it.
  • H: Thought about it for a bit, seems neat, but didn't put too much time in. Got to the point where I was thinking about bounding boxes of the different galaxies, and tried to turn it into some bitmask DP.
»
18 часов назад, # |
  Проголосовать: нравится +15 Проголосовать: не нравится

Considering the fact that I've lost 9,6% of my rating, I don't think this round was that good for me xd

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

In part C, I notice that if I keep the array a unchanged and perform subtraction, then create a reversed array of a as b and perform subtraction, all the values in b will be exactly a * (-1). So you dont really have to create b at all. Here is my submission ^-^ https://codeforces.net/contest/2062/submission/303144045

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

can someone provide some hint for problem D or from where did you start building your solution

I am stuck at how to view the operation even if i fis all the values at all the nodes.

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

    The idea is to always operate on adjacent nodes. If you operate of non-adjacent (u, v) with u -> x -> v (vals = [10, 15, 20]). Now, if you operate on (u, v), you would have left out x with vals = [20, 15, 20]. Now, you would need to increase x anyhow. Operating (u, x) would give vals = [20, 20, 25]. Now, another operation with (x, v) is required with final vals = [25, 25, 25]. Now, this could have been avoided if we had operated on (u, x) first and then with (x, v), giving us final vals = [20, 20, 20].

    Operating on adjacent nodes minimises the cost as we are maintaining the relative differences of other node values and any two adjacent nodes have to be operated separately if they are different (otherwise, the relative difference can never change).

    The key hint here is to fix the root of the tree and try making all the values equal to the root's value.

    Hint 1
    Hint 2

    PS: Sorry for the such a long answer, such details might be trivial and repetitive but this helped me understanding my solution better (as I did not really thought of rigorous proofs). Also, try to prove why fixing any root would give the same answer.

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

      Thanks for the explanation. I will try builiding the solution on it

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

Nice round! (The people in comment section seems to have mythical observability, I failed to guess anything useful lol)

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

I think all problems are very good (at least until F), but putting them together in a single match is somewhat strange.

The Gap between C, D/E1, and E2/F are all too big (the number of accepted participants differs by almost 10 times). I was lucky enough to notice the key to E2 immediately after solving E1 and ended up in a good position. Though many participants got stuck in a single problem (C,D,E2,F are all problems where one could easily go wrong and never come back again), which led to disastrous results.

It would be better to have an easier D and an easier F. In this case the round would be more balanced and a small mistake wouldn't cause too much damage for a single participant.

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

D is tough but I loved it. Thought I was having a chance but I was way off from the solution.

Read the editorial and upsolved, thanks for the contest.

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

only i solved E2 first then realise the solution of E1 ??

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

Submission Can anyone tell why this code is for E1 is giving TLE I wanted to find for each node number of values greater than it in its subtree . I used pbds to store all the values in its subtree

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

please i need like!!!

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

EXTREME huge gap between D/E1 and E2/F.