StarSilk's blog

By StarSilk, history, 35 hours ago, In English

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
  • Vote: I like it
  • +179
  • Vote: I do not like it

»
35 hours ago, # |
Rev. 2   Vote: I like it +126 Vote: I do not like it

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!

»
35 hours ago, # |
  Vote: I like it +28 Vote: I do not like it

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!

»
35 hours ago, # |
  Vote: I like it +41 Vote: I do not like it

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

»
35 hours ago, # |
  Vote: I like it +27 Vote: I do not like it

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

»
34 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope to meet a perfect game on the 1001st night

»
34 hours ago, # |
Rev. 2   Vote: I like it +34 Vote: I do not like it

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

»
34 hours ago, # |
  Vote: I like it +11 Vote: I do not like it

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

  • »
    »
    20 hours ago, # ^ |
      Vote: I like it -39 Vote: I do not like it

    $$$0000$$$ has 4 digits and is smaller than $$$1001$$$... sir!

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

      0000 is not a four digit palindrome it is a one-digit palindrome

»
31 hour(s) ago, # |
  Vote: I like it +13 Vote: I do not like it

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

»
31 hour(s) ago, # |
  Vote: I like it +38 Vote: I do not like it

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

»
31 hour(s) ago, # |
Rev. 2   Vote: I like it +17 Vote: I do not like it

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.

»
30 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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.

»
30 hours ago, # |
  Vote: I like it +7 Vote: I do not like it

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

»
30 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

HOPE TO GET POSITIVE DELTA

»
26 hours ago, # |
  Vote: I like it -13 Vote: I do not like it

i want tourist became again tourist

»
23 hours ago, # |
  Vote: I like it +11 Vote: I do not like it

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

»
21 hour(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
21 hour(s) ago, # |
  Vote: I like it +1 Vote: I do not like it

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

»
20 hours ago, # |
  Vote: I like it -18 Vote: I do not like it

as a green green plant, give me rating!

»
17 hours ago, # |
  Vote: I like it +4 Vote: I do not like it

Score Distribution.

»
15 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
14 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Wishing everyone a Positive Delta <3

Hope i Get to Pupil this time.

A better Score Distribution needed :p

»
11 hours ago, # |
  Vote: I like it +4 Vote: I do not like it

Score distribution ???

»
10 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

palindrome round )

»
9 hours ago, # |
  Vote: I like it +5 Vote: I do not like it

Score distrib => Speedforces?

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

I hope to become CM in this contest.

»
9 hours ago, # |
  Vote: I like it +2 Vote: I do not like it

Another Speedforces round ! :(

»
9 hours ago, # |
  Vote: I like it -17 Vote: I do not like it

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

  • »
    »
    8 hours ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    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.

    • »
      »
      »
      8 hours ago, # ^ |
        Vote: I like it +5 Vote: I do not like it

      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

      • »
        »
        »
        »
        8 hours ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

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

        • »
          »
          »
          »
          »
          8 hours ago, # ^ |
            Vote: I like it +3 Vote: I do not like it

          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.

        • »
          »
          »
          »
          »
          4 hours ago, # ^ |
          Rev. 2   Vote: I like it 0 Vote: I do not like it

          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).

      • »
        »
        »
        »
        8 hours ago, # ^ |
          Vote: I like it +9 Vote: I do not like it

        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.

        • »
          »
          »
          »
          »
          8 hours ago, # ^ |
            Vote: I like it +8 Vote: I do not like it

          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

          • »
            »
            »
            »
            »
            »
            8 hours ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            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.

            • »
              »
              »
              »
              »
              »
              »
              8 hours ago, # ^ |
                Vote: I like it +5 Vote: I do not like it

              yes, I will try to participate and practice more.

»
8 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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

»
8 hours ago, # |
  Vote: I like it -6 Vote: I do not like it

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

»
7 hours ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

glhf xD

»
7 hours ago, # |
  Vote: I like it -9 Vote: I do not like it

As a contestant, I really think StarSilk is a cat

»
6 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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

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

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.

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

unfortunately jiangly has to lose his title soon

»
4 hours ago, # |
  Vote: I like it +19 Vote: I do not like it

how to do DIV 2D?

»
4 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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.

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    by mistake

  • »
    »
    4 hours ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it

    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

    • »
      »
      »
      4 hours ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      Plain brute Force!

      • »
        »
        »
        »
        4 hours ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        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.

    • »
      »
      »
      4 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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))

      • »
        »
        »
        »
        4 hours ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

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

        • »
          »
          »
          »
          »
          4 hours ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          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.

    • »
      »
      »
      4 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      think of vector operation

    • »
      »
      »
      4 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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

    • »
      »
      »
      4 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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

    • »
      »
      »
      4 hours ago, # ^ |
      Rev. 3   Vote: I like it 0 Vote: I do not like it

      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.

    • »
      »
      »
      4 hours ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      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)).

»
4 hours ago, # |
  Vote: I like it +29 Vote: I do not like it

carrot extension is not working anymore?

»
4 hours ago, # |
  Vote: I like it -9 Vote: I do not like it

so where is the solution?

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    editorial takes some time, hoping that they upload it fast

»
4 hours ago, # |
  Vote: I like it +13 Vote: I do not like it

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

»
4 hours ago, # |
  Vote: I like it +57 Vote: I do not like it

Finally got master!

»
4 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

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

»
4 hours ago, # |
  Vote: I like it +27 Vote: I do not like it

Guessforces. So helpless when coding.

»
4 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

F is cool

»
4 hours ago, # |
  Vote: I like it +37 Vote: I do not like it

Why guessforces???

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    This time I really guessed B first before proving it

»
4 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

Why 2.5 hours?

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

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

»
4 hours ago, # |
  Vote: I like it +10 Vote: I do not like it

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.

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I think that is only for educational rounds (and for div3 ??).. not for div2 and div1 rounds, you can only hack during contest after locking your problem

»
4 hours ago, # |
Rev. 4   Vote: I like it +30 Vote: I do not like it

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.

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it -7 Vote: I do not like it

    Sir , Can we do D with binary search ?

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Please post this editorial every round

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

»
4 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

Interesting problem C, enjoyed the contest thoroughly

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yea took me a while to understand that reversing only helps in changing sign and doesnot produce new value

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    C ruined my contest.

»
4 hours ago, # |
  Vote: I like it +2 Vote: I do not like it

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.

»
4 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

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..

»
4 hours ago, # |
Rev. 2   Vote: I like it +25 Vote: I do not like it

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!

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    What did u Guess in C..?

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    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.

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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

»
4 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 hours ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it

    That won't run in time since each node has a range of starting values instead of a specific value. You can't brute force all possible combinations of starting values.

»
4 hours ago, # |
  Vote: I like it -7 Vote: I do not like it

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!

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    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.

    • »
      »
      »
      27 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yes , E1 is a very beautiful implementation of ETT 2 and segment tree

»
4 hours ago, # |
  Vote: I like it +4 Vote: I do not like it

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

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I changed it at the last minute before submitting

    I stress tested some random testcases and noticed that they looked a bit weird

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    its me.

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Some realized that it avoids a lot of problems to allways use 64 bit since it costs like nothing.

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it -6 Vote: I do not like it

    I did not use long for C: https://codeforces.net/contest/2062/submission/303063303

    it passed main tests

    • »
      »
      »
      3 hours ago, # ^ |
        Vote: I like it +6 Vote: I do not like it

      You are using 64 bit integers everywhere.

      • »
        »
        »
        »
        3 hours ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You’re right; unfortunately I can’t delete my comment now :(

    • »
      »
      »
      3 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Wtf, I just realized I used long long; must have been some god’s enlightment or something like that

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I am still unable to understand why do we need long long in this problem. How can the sum go beyond 32-bit ?

    • »
      »
      »
      3 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Take 1000, -1000, 1000, -1000, … And see what happens when you keep taking the diff between two consecutive values.

    • »
      »
      »
      3 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      there is a pattern in the problem. if you find the final number (when the size of array is 1): if n == 3 ---> -1 2 -1 (these are coefficients to be multiplied to the array elements) if n == 4 ----> -1 3 -3 1 if n == 5 ----> -1 4 -6 4 -1 and so on

      so this can blow up for n == 50 where there will be a term 50C25(binomial).

    • »
      »
      »
      3 hours ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      The differences can go up to $$$2^n\cdot max(a_i)$$$. For example -1000,1000,-1000,...

»
4 hours ago, # |
  Vote: I like it +23 Vote: I do not like it

guessforces!

»
4 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

really want an upovte? and please editorial??

»
4 hours ago, # |
  Vote: I like it -6 Vote: I do not like it

D why

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
4 hours ago, # |
  Vote: I like it +10 Vote: I do not like it

anyone solved E1 using small to large ?

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Explain the solution pls

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I sorted by weights large to small and used binary lifting, did you do it the other way around?

  • »
    »
    3 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I did, but during contest, most of my time was wasted in researching about how to find "number of elements larger than x" and figured that PBDS would do the job but implementing that also took a lot of time. Not knowing standard stuff hurts. Anyways, my swap function was not O(1) which I figured after the contest.

    AC submission (after contest): https://codeforces.net/contest/2062/submission/303136352

    • »
      »
      »
      114 minutes ago, # ^ |
      Rev. 6   Vote: I like it 0 Vote: I do not like it

      thanks for your help but my solution use map seem we have the same idea in my solution I compressed a[i]

      i dont know is it work well if i swap map and map

      the solution without swap when comparing sizes 303145289 (mle on test 5)

      the solution small to large merging (with swap)303145216 WA on test 1 (test case 2) idk why

      I dont know am i wrong somewhere or is it illegal to swap map and map ? (sorry for my bad english)

»
4 hours ago, # |
  Vote: I like it -36 Vote: I do not like it

This problems are so bad

»
3 hours ago, # |
  Vote: I like it -31 Vote: I do not like it

A terrible round, thank you

»
3 hours ago, # |
  Vote: I like it +30 Vote: I do not like it

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

»
3 hours ago, # |
  Vote: I like it +6 Vote: I do not like it

Treeforces (and I liked it)

»
3 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

please dont make monkey problems like A

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    39 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Don't know if it is theoretically correct but past 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.

    • »
      »
      »
      4 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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).

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Where editorial?

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

jiangly may lose his title due to this contest

»
2 hours ago, # |
  Vote: I like it +17 Vote: I do not like it

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.
»
2 hours ago, # |
  Vote: I like it +9 Vote: I do not like it

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

  • »
    »
    96 minutes ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    Once a grandmaster, always a grandmaster

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

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

»
82 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

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.