SlavicG's blog

By SlavicG, history, 18 months ago, In English

Hey, hi Codeforces!

It's mesanu, flamestorm and me and we are very excited to invite you to Codeforces Round 871 (Div. 4)! It starts on May/06/2023 17:35 (Moscow time).

We worked swiftly to tailor the problems for this contest, so we hope you will enjoy them! We tried to make the statements short, epic and concise.

The format of the event will be identical to Div. 3 rounds:

  • 5-8 tasks;
  • ICPC rules with a penalty of 10 minutes for an incorrect submission;
  • 12-hour phase of open hacks after the end of the round (hacks do not give additional points)
  • after the end of the open hacking phase, all solutions will be tested on the updated set of tests, and the ratings recalculated
  • by default, only "trusted" participants are shown in the results table (but the rating will be recalculated for all with initial ratings less than 1400 or you are an unrated participant/newcomer).

We urge participants whose rating is 1400+ not to register new accounts for the purpose of narcissism but to take part unofficially. Please do not spoil the contest for the official participants.

Only trusted participants of the fourth division will be included in the official standings table. This is a forced measure for combating unsporting behavior. To qualify as a trusted participant of the fourth division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them),
  • do not have a point of 1400 or higher in the rating.

Regardless of whether you are a trusted participant of the fourth division or not, if your rating is less than 1400 (or you are a newcomer/unrated), then the round will be rated for you.

Many thanks to all testers: RedstoneGamer22, tibinyte, sandry24, jampm, haochenkang, qwexd, Vladosiya, _Vanilla_, Phantom_Performer, ScarletS, NintsiChkhaidze, keta_tsimakuridze, Dominater069, Gheal, Bakry!

And thanks to Vladosiya for russian statement translations!

We suggest reading all of the problems and hope you will find them interesting!

Good Luck and have fun!!

Are you ready for it?

UPD: Editorial is out!

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

| Write comment?
»
18 months ago, # |
  Vote: I like it +39 Vote: I do not like it

As a tester, problems are great!

»
18 months ago, # |
  Vote: I like it -17 Vote: I do not like it
Click for positive delta
»
18 months ago, # |
  Vote: I like it +140 Vote: I do not like it

As a tester, I recommend listening to Taylor Swift while participating in this round.

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

queue

  • »
    »
    18 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it
    Fact
  • »
    »
    18 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Gheez, smooth round..nice problemset but I think F was way easier than E

»
18 months ago, # |
  Vote: I like it -40 Vote: I do not like it

so trash contest xD

»
18 months ago, # |
  Vote: I like it +5 Vote: I do not like it

Damn excited for this round. Hope I will become master after this round

»
18 months ago, # |
  Vote: I like it +26 Vote: I do not like it

As a tester, I won't make clickbaiting claims and I won't beg for upvotes.

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

Ya slavicG div4 contest

»
18 months ago, # |
Rev. 2   Vote: I like it +30 Vote: I do not like it

New specialist (including me and 69 others) in div4 comments section,,,

IMG-3731

»
18 months ago, # |
  Vote: I like it +37 Vote: I do not like it

I am really excited to participate in a Div4 contest on my birthday, and also hoping for positive delta!

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

Just +20 to get to pupil. Hope i will do it tomorrow

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

    Seems like i will made pupil. delta prediction is +66 and i just need +20. I think this time it is great. I was able to solve 6/8 problem in less than 1h25min but G i had TL and solved it just at the end of contest unfortunately.

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

As a tester, this is surprisingly not that bad for a Div. 4

  • »
    »
    18 months ago, # ^ |
      Vote: I like it +14 Vote: I do not like it

    As a tester, I'm not sure I agree

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

  • »
    »
    18 months ago, # ^ |
      Vote: I like it +13 Vote: I do not like it

    I am seeing the same meme for the past 3 years on Codeforces. At least post something else.

»
18 months ago, # |
  Vote: I like it +14 Vote: I do not like it

Praying for +14 delta

»
18 months ago, # |
  Vote: I like it +5 Vote: I do not like it

It's my first "out of competition" contest after a great success on round #870 lol.

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

As usual I liked the cat in Vladosiya's profile.(´◡`)

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

Thanks

»
18 months ago, # |
Rev. 2   Vote: I like it +5 Vote: I do not like it

Are you ready for it?

»
18 months ago, # |
  Vote: I like it +10 Vote: I do not like it

We urge participants whose rating is 1400+ not to register new accounts for the purpose of narcissism but to take part unofficially. Please do not spoil the contest for the official participants.

This part is amazing!)

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

Although I am unrated, I still want to participate. Is there anyone else who feels the same as me?

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

Hello everyone! Have a great round and a good mood.

»
18 months ago, # |
  Vote: I like it -32 Vote: I do not like it

Queue Forces!!!!

»
18 months ago, # |
  Vote: I like it +40 Vote: I do not like it

Very fast loading and queue for div4! Pretty nice, Good Job Codeforces team!

»
18 months ago, # |
  Vote: I like it +18 Vote: I do not like it

nice Taylor Swift round.

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

Good contest, quit after solving 2 problems.

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

    Good contest, quit after speedforcing first 6 problems and being too dumb for G and H.

»
18 months ago, # |
  Vote: I like it +7 Vote: I do not like it

Taylor Swift Round 871!

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

    Have you noticed the references in the announcement?

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

Today's contest was really fun and interesting. Appreciate the problem setters :)

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

Very good problems, especially H. Thanks to the authors for a cool contest.

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

Single people after reading problem A:

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

How to solve D? used BFS for each N, but got TLE.

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

Short Editorial :

  • A : Iterate over the string and count where the characters differ.
  • B : Count the maximum consecutive zeros in the array.
  • C : The answer is -1 if either of the string value is zero for all n books. Otherwise ans=min(fir+sec,both) where fir-minimum mi with si1=1,sec=minimum mi with si2=1,both=minimum mi with s11=1 and s12=1.
  • D : If m>n, answer is no.we can only divide n if n is a multiple of 3 into pieces n/3 and 2*n/3.Thus, m/n=2^x/3^y where x<=y, iterate for all possible y(3^y<=10^7 , y<=15 ) and find if any integer x satisfies the equation.
  • E : Basic BFS or DFS question.
  • F : From the properties , we can see that m=(y+1)*x,n=1+x*(y+1),find degree of all nodes.Now, x*y nodes will have deg=1,x nodes will have deg=y+1 and 1 node will have deg=x.
  • G : Initialize sum=n*n for each n<=1e6, now take prefix sum of both both type of all diagonals and you have your answer. For example- initially sum[13]=13*13,sum[9]=9*9,sum[8]=8*8,sum[4]=4*4, after taking prefix sum of right to let type of diagonals, sum[13]=13*13+9*9+6*6,sum[9]=9*9+6*6,sum[8]=8*8+5*5+3*3, sum[4]=4*4+2*2+1*1,taking prefix sum of left to right type of diagonals, sum[4]=4*4+2*2+1*1 , sum[8]=8*8+5*5+3*3+sum[4], sum[13]=13*13+9*9+6*6+sum[8].
  • H :Since each qi<=63, AND of any subsequence <=63,Initialise array of size 64 where value of dp[i] is equal to total number of subsequences having AND value i.Now, traverse through the array ,for a value v[i] we take it's AND with all possible values [0,63] and update dp accordingly. Finally, add all dp[i] where number of bits in i is k. See 204835949 for implementation.
  • »
    »
    18 months ago, # ^ |
    Rev. 2   Vote: I like it +3 Vote: I do not like it

    what would be the actual rating of G and H according to you? I guess something around 1500 for G and maybe 1800 H

  • »
    »
    18 months ago, # ^ |
    Rev. 2   Vote: I like it +3 Vote: I do not like it

    In problem F, if the values of both x and y are greater than 1, values of n & m should at least be 7 & 6 respectively, right? But the problem statement says that n can be 2 and m can be 1 [2≤n≤200; 1≤m≤min(1000,n(n−1)2)]...essentially meaning x can be 1 and y can be 0! I'm a bit confused about how to handle such cases of input as my solution got WA.

    • »
      »
      »
      18 months ago, # ^ |
      Rev. 2   Vote: I like it +3 Vote: I do not like it

      For an input to be valid, all constraints have to be fulfilled. These are the two different constraints you're thinking about:

      1. $$$2 \le n \le 200$$$; $$$1 \le m \le \min(1000, \frac{n(n−1)}{2})$$$
      2. It is guaranteed that this graph is a snowflake graph for some integers $$$x$$$ and $$$y$$$ both greater than $$$1$$$.

      It doesn't matter that constraint 1 allows cases like $$$n = 2$$$ or $$$m = 1$$$ since these are impossible according to constraint 2. As I said, all constraints have to be met for an input to be valid. Thus, these cases can never appear and you don't need to consider them in your code.

      UPD: The reason you got WA is because there is an edge case you missed. Here is one test case where your code fails:

      Spoiler

      Can you see why this happens?

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

        Hint: The edge case scenario is described in the editorial.

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

can anyone help me with prove the complexity of my code on D? thanks: https://codeforces.me/contest/1829/submission/204812242

»
18 months ago, # |
  Vote: I like it +110 Vote: I do not like it

I am very glad that my idea (see https://codeforces.me/blog/entry/114062#comment-1014185) worked and there was no queue today!

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

In F , according to the constraints , if m = 1 , then how x and y could be both greater than 1 such that x*(y+1) = m = 1 ??

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

    Since inputs are always valid, $$$m$$$ cannot equal 1. Even though the constraint $$$1 \le m \le \min(1000 , \frac{n(n−1)}{2})$$$ allows it, no valid snowflake graph can have only 1 edge. The constraint "It is guaranteed that this graph is a snowflake graph for some integers x and y both greater than 1" "overrides" the fact that $$$m = 1$$$ is allowed by the previous constraint.

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

      ah ok , seems right m can't be a prime number , this thing confused me during the contest:(

»
18 months ago, # |
  Vote: I like it -9 Vote: I do not like it

Solution of A.Love Story — 871A Question with code and explanation of it

https://codeforcer.blogspot.com/2023/05/love%20story.html

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

    why do we need tutorial of A? Everyone can do it with ease.

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

      You are very talented btw, it was not for you. so kindly ignore it. instead of talking for the solution you can talk about approach too. btw the way thanks for commenting out.

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

TAYLOR SWIFT REFFERENCES!? AFTER HER SPEAK NOW TAYLOR’S VERSION ANNOUCEMENT!? I CANNOT-

(sorry for all caps i’m just a big swifty :>)

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

    Did you notice the references in the announcement?

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

Finally Solved my first dp question in live contest. Despite Div 4, happiness nd motivation bcz of DP is overflowing :)

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

    how did you reach Specialist without knowing Dynamic programming?

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

      note the word live contest, he never said its his first dp solve, he said its first dp solve in live contest.

      This is because other contests unlike div4 wont give a problem which is just knowing dp, but you need to make other harder observations on top of them.

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

Can somebody explain me why this solution got TLE?

https://codeforces.me/contest/1829/submission/204844540

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

    You cannot clear the $$$1000 \times 1000$$$ arrays matr or vis completely every time if there are $$$10\ 000$$$ test cases since this would require $$$1000 \cdot 1000 \cdot 10\ 000 = 10^{10}$$$ operations which is not fast enough. Even though memset is fast, it's only a constant factor improvement over manual clearing. You should just clear the arrays manually in the required sections for each test case.

    UPD: You should also increase your arrays matr and vis to $$$1002 \times 1002$$$ from $$$1001 \times 1001$$$ so that you have the exrta "buffer layer" on every side of the used area. 204881319

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

Overall a great round. Well-balanced Problem Set. Although standard ideas were involved, but liked Problems G and H especially. Good educational problems for DP I would say.

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

    Ya I totally agree, the problems were like "INTRODUCTION TO TREE,GRAPH,DP,etc"

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

This was a really nice contest! I particularly enjoyed G and H. (D was also nice.)

I bashed E with DSU ;)

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

Good contest! It makes me know that small mistakes will lead to fatal errors.(In details,I misused variables in for-loops for consecutive 3 problems and wasted plenty of time to fix them....)

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

Finally, solved all.

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

Hint for G. Hits Different ?

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

    Precalculate max(max_i), and min(min_i) values of each row(i). You can calculate Sum(i^2) from i=a to b in O(1). First find row where N is(R). Each row(R, R-1, ... 0) you can calculate start and end numbers of can that falls(Using previous rows start and end number + max_i and min_i). And add SUM(Start, end number) to the answer.

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

E was exactly same as https://leetcode.com/contest/biweekly-contest-103/problems/maximum-number-of-fish-in-a-grid/

If someone copies my code from here is there any chance that my solution can get skipped?

Also this question is from latest biweekly contest on leet code. How can there be soo similar question again on CF.

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

    How would someone would copy your code from there except you? i don't think so your solution will be skipped, coz i also copied my code from old submission

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

      Solutions are visible in contest leaderboard

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

    its a very standard problem, and every tester told the same in testing, however apparently, having standard problems in div4 is fine.

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

      and for having those standard problems, beginners can reinforce their newly learnt concepts and algorithms too! so i don't think it's a big deal after all in my opinion

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

        yes, sure, just make those contests unrated then. In my opinion, rated contests should not be having standard problems.

        CSES exists, other tons of archives exists. Beginners can solve standard problems from there. They should not be getting rating for copy pasting codes to standard problems.

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

          if they know all standard problems than they aren't Beginners at all :3

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

            Disagree, a person can know 1000 standard problems and still unable to solve a div2A because they have not seen it before.

            This type of person is what this div4 round encourage :(

            Maybe i am wrong, but most other div4 rounds dont have classical problems atleast in hardest slot, and as mentioned above, E is literally a leetcode problem.

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

              well, with your perspective a lgm can consider a certain problem standard which might still be out of your knowledge, also most of the problem in div2 that they solve might be of some similar concept which they would have already seen in the past, so that doesn't mean the problems like that shouldn't be created just because they felt it quite reused and standard. Hope i was able to say my point clearly

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

                I think there is a big difference in making a standard problem, and having a problem be standard to someone. Today's E and H are examples of the former.

                I cant find any examples of the former in recent div2 rounds, even if they need standard knowledge, they are not just that. You need to make some observations after that. Perhaps you can enlighten me to some problems i missed which are completely standard in div2(in recent times and preferably one of the easier ones not F or smth)

                As for the lgm point, yes there are definitely such problems which an lgm would find standard and i still cant solve. I dont see whats wrong with that. The lgm(hopefully) and me would oppose putting such problems in a div1 round.

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

          yeahh, actually i agree with you on that. overall i do think the later problems in the contest are less dificult compared to the other div 4s. nevertheless, the problems are still interesting and the contest is one of my favorites so far!!! :>

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

            Its not about the difficulty. A slightly easier contest is fine. One cannot always have the correct difficulty.

            However, i think all rated rounds should have original problems. bad problems are better than unoriginal ones.

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

I am curious, was the theme determined after the announcement of her new album or are they unrelated?

  • »
    »
    18 months ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    The announcement of her new album was determined based on the theme.

    But in all seriousness... it was a coincidence she announced it on the same day :D We had the theme set for quite some time before it.

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

    The collaboration I never knew I needed.

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

This contest has given me a very big motivation ( and hopefully a very big rating :) ). Thank you for the creators of this contest, I really liked problems, especially the problem H.

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

The contest was great

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

Cool contest, last 3 problems were interesting and at a good difficulty level for myself.

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

First time I can solve a graph problem (1829F - Forever Winter) ^_^

»
18 months ago, # |
Rev. 2   Vote: I like it +20 Vote: I do not like it

Is it legal for two or more people to participate using the same account?

I think this account c0nf11c7 is being used by two or more people in this contest.

Here are the clues that lead me to believe this:

  1. Some of the code has strange symbols, while other code does not.
    This is unusual, as we usually use the same template during the contest.

  2. There is only an 11-second gap between problem C and H, and the templates of them are different.
    C: https://codeforces.me/contest/1829/submission/204766645
    H: https://codeforces.me/contest/1829/submission/204767094

If this is indeed cheating, please take action as soon as possible.

MikeMirzayanov should look for this.

»
18 months ago, # |
  Vote: I like it +20 Vote: I do not like it

Best Contest of my life

Thank you all

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

if i hack some people i'll gain extra elo ?

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

Hello, CF why I it give me TLE here 204890621 I replace if (n%3!=0) by if(n/3*2!=n-n/3)

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

    you are resetting your dp array everytime which made it $$$O(1e7 * t)$$$.
    Try using map to memoize.

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

      Thank you, but why it did not give TLE on test 1 And my friend do the same thing but vector v(max(n, m), 0) but he get accepted

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

        why it did not give TLE on test 1

        The code only TLE's if there are too many test cases. Test 1 has only 11 test cases and resetting the array 11 times is fast enough. Resetting it 1000 times is not fast enough.

        And my friend do the same thing but vector v(max(n, m), 0) but he get accepted

        That sounds like it shoudn't pass the time limit (or I'm just stupid). Can you send a link to your friend's code?

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

hello everyone, first of all I am sorry for bad English. Can someone tell me about the best place where I can reed about theories in c++?

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

Video Solution Of All Problems.

Link : https://youtu.be/axLtBF-td3o

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

Nice contest, btw in case someone is interested: This is a similar problem to C

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

a good day to be a swiftie on codeforces

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

https://codeforces.me/contest/1829/submission/204906135 https://codeforces.me/contest/1829/submission/204781971

I have viewed the hack log and wonder why some people wrote these code that looks like a backdoor.

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

When will I gain a rate?

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

Failed system test on D :( My submission

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

I am a newbie with ~600 rating, then why is this contest showing to be unrated in my contest section!

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

    The ratings are not updated yet, so It is normal for the results in your contest section to appear as Unrated. Let's wait until the rating is updated!

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

Great problems! Problem F is really impressive!

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

Expected to cross newbie level with this contest, but fine, it was a great contest with interesting problems

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

Swifties round :)

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

Can anyone tell me why I got -40 even though I solved A and B ?

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

    The contest was Div.4 — it means the problems were easier, and you had to solve more problems than usual to get expected performance in the contest.

    In this contest, you got performance of 321, it's lower than your rating, so unfortunately you received a negative rating change for that.

    Better luck next time! You can install the Carrot Extension to see the predicted rating changes.

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

Nice probelems

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

I tried solving G with DP, but it is even failing on the first test case:

Spoiler

P.S: I'm sorry about the bad format of the code, I don't know how to make it look good.