By awoo, history, 3 months ago, translation, In English

Hello Codeforces!

On Nov/19/2020 17:35 (Moscow time) Educational Codeforces Round 98 (Rated for Div. 2) will start.

Series of Educational Rounds continue being held as Harbour.Space University initiative! You can read the details about the cooperation between Harbour.Space University and Codeforces in the blog post.

This round will be rated for the participants with rating lower than 2100. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally.

You will be given 6 or 7 problems and 2 hours to solve them.

The problems were invented and prepared by Roman Roms Glazov, Adilbek adedalic Dalabaev, Vladimir vovuh Petrov, Ivan BledDest Androsov, Maksim Neon Mescheryakov and me. Also huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.

Good luck to all the participants!

Congratulations to the winners:

Rank Competitor Problems Solved Penalty
1 dlalswp25 6 205
2 Ormlis 6 207
3 Tlatoani 6 214
4 yokozuna57 6 232
5 peti1234 6 235

Congratulations to the best hackers:

Rank Competitor Hack Count
1 racsosabe 80:-17
2 Elo 33:-4
3 peti1234 24
4 STUPID_JUSTIN 26:-7
5 xiaofan7 25:-10
605 successful hacks and 888 unsuccessful hacks were made in total!

And finally people who were the first to solve each problem:

Problem Competitor Penalty
A Geothermal 0:01
B SSRS_ 0:04
C Valera_Grinenko 0:02
D SSRS_ 0:10
E Akulyat 0:38
F Suiseiseki 0:58
G rainboy 0:42

UPD: Editorial is out

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

»
3 months ago, # |
Rev. 4   Vote: I like it -6 Vote: I do not like it

Deleted

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

    Hey I want to know why you got downvoted... You were just wishing everyone good luck. Am I missing something? I feel bad for you :(

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

      Anything that's obvious, repeated and doesn't adds value and just adds an extra comment for the sake of it and just increases the time to read the comment thread gets downvoted mostly, and sometimes people do it just for fun as well to channel their frustration of a bad contest or something. I have a feeling this will be downvoted too, but that's all there's to it, the explanation you were looking for.

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

    Don't worry we will upvote you eventually. Love from Sweden!

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

I have a feeling this is going to be a good one.

»
3 months ago, # |
  Vote: I like it -15 Vote: I do not like it

road to cyan

»
3 months ago, # |
  Vote: I like it -52 Vote: I do not like it

After last contest's C1, C2, More hopes from Educational round! -_-

»
3 months ago, # |
  Vote: I like it -46 Vote: I do not like it

there is almost 10 days difference between the techno cup round and the next div 2 round .... plz if we can have some contest in between??

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

    yes sir! how many contests you order?

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

      I would like to order 2 contests without shitty implementation problems and pack it nicely into short statements. Strong pretests will be appreciated.

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

    You needn't think about that in this much advance.. Mostly contests will pop up around 3-5 days before they will be held. And that much of advance notice is enough and there are many Coding Contest Tracker Apps to help you with tracking(Coding Schedule for example) if you need one.

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

    include<bits.stdc++.h>

    using namespace std; string main(){ int rating,contribution; if(rating<=2000) { cout<<"YOU GET DOWNVOTES"; contribution--; } else { cout<<"YOU GET UPVOTES"; contribution++; } return "YOU UNDERSTAND THE CORRECTNESS OF YOUR COMMENT NOW?? IT DEPENDS ON YOUR RATING NOT ON YOUR CONTENT"; }

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

      congras, your programme gives the expected output :v

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

        Seems like its yielding no output for yours.Can you guess why??Just out of curiosity, haha.

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

I wish I would do better in this contest. Hopefully ,I will do it.

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

I'm so excited and waiting my first contest on cf platform. Thank you MikeMirzayanov for great systems Polygon and Codeforces.

»
3 months ago, # |
  Vote: I like it -48 Vote: I do not like it

Is it rated?

»
3 months ago, # |
  Vote: I like it -27 Vote: I do not like it

Hello Beautiful people:) i'm not so skilled and i have a question what is the difference between Educational Rounds and another contest for example Codeforces Round #684 ??

»
3 months ago, # |
Rev. 2   Vote: I like it -62 Vote: I do not like it

As a 1-gon give me contribution

Edit: I'm getting scammed, rip

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

Again an educational round without any tester? What if we observe any issue with test case/problem explanation later during the contest? We still have around 19hrs, I guess we can have some testers and there feedback?

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

    Why is he downvoted? He raises a fair point I think?

    (Edit: his comment was downvoted when I wrote my comment)

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

      wah bencho red ho gya tu to.

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

        Now that was a normal day to day style of talking but I guess your profile name can also be the biggest reason for you getting downvoted.. Why do my friends get creative in the most extreme ways ?

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

      Exactly, I was just talking about one of the possibility based on past educational round. Lets hope we see a healthy round today.

      I don't think there would be any harm in having few testers, there are many yellow/red participants who participates in educational round, for them round will already be unrated. So we can maybe ask for volunteers? Even many rated participants would be ready to volunteer.

      awoo what do you think? This will just decrease the chances of any actual issues in the problemset.

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

      Seriously, why does it take a red's agreement to give this person the upvotes he deserves.

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

        ratism is real on CF.

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

        It's about the respect I guess towards the work put in to get to red !

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

    +1 from my side.. We already witnessed(Round 682) what happens when something unorganised goes from tester's side. And this one is without them wholly.. Fingers crossed

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

Chasing CM dream...
Wish I would not lose my ratings.

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

Last two contest was horrible. Finger crossed this time

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

    I think CF Round #683 was not horrible, what do you think?

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

      Oh, My bad! I was talking about Round 684 and 682. Round 682 has a nice set of problems but went unrated! Thanks for pointing out Lemonade255

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

I just want to make my contribution to 0 from negative.

I know I may add more negative contributing from this comment but still I want to give it a try.

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

    those who upvoted I really wanna thank you. But I think its not going to work. Anyways Good luck for today's contest.

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

      If you really want to make your contribution >=0 in this post, I think you should comment few more comments in this thread. More the comments, more is the risk but more are the chances you will gain large contribution in this.

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

        no I am not greedy. I just want my contributions to 0 from negative.

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

          Lol, I must say that itself is greedy.

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

            haha, you can say.

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

              Seems like u achieved your mission.

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

                yes... Thank you everyone who upvoted...

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

      now target is very close.

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

    Now that's a nice way to get upvotes.

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

Please make my contribution from -1 to 0.

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

Yes more questions related to Mr.Monocarp as always

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

upvote and down vote should be logically. First time i comment and I just expressed my feelings, but why am i getting down vote? It makes me frustrated. But i realized, upvote and down vote means contribution for codeforces. Please, make me 0 contribution from negative.

»
3 months ago, # |
  Vote: I like it -8 Vote: I do not like it

Hey guys ,do check https://gameofcodes.herokuapp.com (Okay, I know its a promotion, but the whole site is for codeforces lovers, so I guess its okay)

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

    Do you have to purchase a Domain Id(Website) for hosting your app on Heroku or is it something else? BTW cool app but the Profile Section is still old school and Profile Pic gets smacked on the screen

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

    Why So downvotes? I think dude has made a cool website, though it loads a bit late. But I think the UI is just awesome.

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

      Glad you like it. Don't worry about the downvotes... it just motivates me to make it much cooler and make it more user friendly.

»
3 months ago, # |
  Vote: I like it -27 Vote: I do not like it

can you guys please help me remove -3?? plz

»
3 months ago, # |
  Vote: I like it -14 Vote: I do not like it

Trump 2020

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

All the best Goiss !!! Just making my contribution >=0 from negative.

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

how to make friends on codeforces?i have 0:(

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

    By clicking the star from their profile page

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

    u can click star but that will make the user your friend.it will not increase your count of friends.for that somebody needs to click on the star of your profile

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

This comment section is a bit weird...

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

5 mins before being destroyed. (Educational rounds are usually harder)

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

very excited for this contest..

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

Hope petya, vasya, or their friends aren't too confused.

»
3 months ago, # |
  Vote: I like it -14 Vote: I do not like it

Highly unbalanced round :(

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

How frequently are you guys able to solve C in div2?

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

.

»
3 months ago, # |
Rev. 2   Vote: I like it -39 Vote: I do not like it

Definitely losing lots of rating, can I get some contribution upvotes? :((

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

B and D should interchange their position :)

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

    D is a stupid problem.

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

      The contest is still going on man! Calm down

      These remarks just give away hints

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

        maybe you are right, but i don't think calling a problem stupid gives any kind of hint.

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

          Anyone who solved B but couldn't solve D would become biased after reading this, don't you think so?

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

            no, i don't think so. But i will make sure not to make such comment during ongoing contest.

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

            yaa I solved B but couldn't solve D I should have read above comment

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

    Whats the trick to B? Solved A, C, D still couldnt figure out B.

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

problem E is very hard. and I think they should have switched places of problem c and b. D is a very interesting problem. Good luck everyone!

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

void correctDifficultyOrder(){ swap(C,A); /* C, B, A */ swap(B,A); /* C, A, B */ } /* Correct question difficulty order => C, A, B */
»
3 months ago, # |
  Vote: I like it +14 Vote: I do not like it

C < A < D < B

»
3 months ago, # |
  Vote: I like it -21 Vote: I do not like it

A wise man once said — "Why no testers?", and he got downvoted. The result: this round

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

    difficulty should have been A<C<D<B for the first 4 problems.

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

Something seems wrong with the official scoreboard, it is also showing for users having rating >= 2100.

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

You should've switched the C to B, D to C and B to D. Time penalties just killed my contest. And there comes very tough E so I can't even come back

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

    Maybe C with B should have been swapped, yes. But B with D? Are you serious?

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

      For me, formula for B wasn't that straightforward. And I also needed construction to get the idea is correct

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

      D seemed pretty standard. I still don't know how to solve B lol

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

      I also confused about people's comments. How they swap B with D. I can't still understand D.

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

    The order was the same for everyone, so you have only yourself to blame for your poor strategy choices.

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

This round is pure destruction.

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

    Exactly! I solved D with no difficulty, but couldn't solve B.

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

      How to solve D ?

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

        (nth fibonacci number)/ $$$2^n$$$

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

          Can you explain why number of arrangements will be equal to nth fibonacci number? I don't know about this. Thanks in advance.

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

    Educational rounds are always pure destruction for me for some reason

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

What is C ? Trollforces ? I want to ask authors that why would they think this problem to be worthy at a position for D2C

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

    We estimate the difficulty of ER C as Div2B, not Div2C. Do you think that this problem is easier than Div2B?

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

      Yes!

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

      Oh ok .. I never knew such a thing also existed. Also I liked the problem D. Thanks for the round once again.

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

How to solve D ?? Can anyone explain the answer for the first test case ? .. i even failed to understand the test case with 1 hours . poor me :(

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

    Can you tell how is B solved ??

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

    nth fibonacci * inverse(2^n). You can try brute force by recursion on some small numbers and check the pattern. The question is how many ways are there of choosing (only)odd numbers so that there sum is perfectly n.

    When n=2
    1 1
    
    When n=3
    1 1 1
    3
    
    When n=5
    1 1 1 1 1
    1 1 3
    3 1 1
    1 3 1
    5
    

    These are the ways of arranging radio towers on different n.

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

    The main idea is that lets say you want to cover the region of n blocks, then what you can do is take the 1 position and make the tower to have 1 power, take 3 position and put tower in the middle with power 2, take 5 position and and put tower in the middle with power 3, and so on.

    So for a state with n position we get a nice recusive relation

    f(n) = f(n - 1) + f(n - 3) + f(n - 5) .....
    

    In the end since we are required to print the probability which is equal to f(n) / 2 ^ n where 2 ^ n are all possible configurations and f(n) are valid configurations. Also remember this all happens under mod

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

      Hi, I got that x/y will be f(n) / 2 ^ n and wasted a lot of time on that mod operation but couldn't solve. Can you please explain?

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

      ******you used modExp(y, mod-2). why everyone used mod — 2.. I didn't understand.. can you please explain...*********

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

        Rafiqul01 In this blog, you can see at the end of Fermat's Little Theorem, we get inv(a)≡a^p−2(modp), substitute 'p' with the 'mod' number given and 'a' with 2^n

        Ji_Kuai So for summary, I can remember this: (x/y)(mod p) = (x * pow(y, p-2))(mod p) right ?

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

          Yes, also be careful at that p must be prime

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

Whoever made problem D, I love you. Fibonacci sequence popped out of nowhere. Could someone please share a solution to F?

»
3 months ago, # |
Rev. 2   Vote: I like it -16 Vote: I do not like it

Me:

  • Didn't solve B
  • Solved D in 70 seconds (And yes, I mean it, that's from scrolling to "Problem D" to getting Accepted)

"That's what we call a balanced problemset"

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

Nice DIv3 till D and DIv1 after D . If I am not wrong it seems (Div1 +DIv3)/2===> DIv2.

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

the gap between D and E is huge man

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

Solution for problem D: The probability of choosing any $$$a_1,a_2,\dots ,a_k$$$ is the same for all, $$$\frac{1}{2^n}$$$ as we have to chose those and not chose the others, so we just want to find the number of subsets of $$$1,2,3,\dots ,n$$$ that work.

Let's call this number of good sequences $$$a_n$$$. Notice that if $$$i$$$ is the smallest element that was chosen then it needs to cover $$$1$$$ while not hitting $$$0$$$ so the radius is exactly $$$i-1$$$. Therefore it covers $$$[1,2i-1]$$$ and we have to cover $$$[2i,n]$$$ without hitting $$$2i-1,n+1$$$. This is the exact same problem with $$$n-2i+1$$$ elements. Therefore, we have:

$$$a_n = a_{n-1}+a_{n-3}+a_{n-5}+\dots $$$

We can see that $a_0 = 1$ and $$$a_1 = 1$$$. So using this recursion we calculate $$$a_2 = a_1 = 1$$$, $$$a_3 = a_2+a_0 = 2$$$, $$$a_4 = a_3+a_1 = 3$$$ and $$$a_5 = a_4+a_2+a_0 = 5$$$. At this point we realize this is the Fibonacci sequence, and we can prove it with strong induction. $$$a_{2n-1} = a_{2n-2}+\dots + a_2+a_0 = F_{2n-2}+\dots + F_{2}+F_{0}$$$ from the hypothesis $$$F_{2n-3} = F_{2n-2}+\dots F_{2}+F_0$$$ so the above is just $$$a_{2n-1} = F_{2n-2}+F_{2n-3} = F_{2n-1}$$$. The even case is similar.

Therefore the answer is just $$$\dfrac{F_n}{2^n}$$$.

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

    While solving, I didn't realize dp[N] = F(N).

    I solved it with dynamic-programming.

    Code

    Nice observation.

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

    Thanks for the explanation.

    this is how i solved D
    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      At first I was solving this problem as the coin change problem considering order of coins mattered where n is the money and I have coins with odd values :P. Implemented full DP just to see it was fibonnacci.

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

    The way I solved it is noticing the problem comes down to "Find the number of ways that you can express a number $$$n$$$ as a sum of odd numbers". Pretty well known this is found with the Fibonacci Series.

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

    That's nice! I solved it in a more dubious way. My solution is based on the following observation: suppose the first active tower is x, then towers 1 -> x-1 and x+1 -> 2*x-1 are not active. Ok, now say we have N towers and we activate the first tower. Its signal power is obviously 1. This leaves us with the other N-1 towers and the initial problem, but with only N-1 towers. If we say dp[i] = the solution for i towers, then we can now state that dp[i] = 1/2 * dp[i-1] + something (1/2 is because we have to activate the first tower) Now suppose the first tower we activate is the second one. Its signal power is 2 and the first and third towers are not activated. Excluding these towers, we have the initial problem but with N-3 towers. So dp[i] = 1/2 * dp[i-1] + 1/8 * dp[i-3] + ...

    Let's take some examples: dp[5] = 1/2 * dp[4] + 1/8 * dp[2] + 1/32 * dp[0] dp[4] = 1/2 * dp[3] + 1/8 * dp[1]

    We can keep 2 partial sums, one for odd numbers and one for even numbers. When we calculate dp[5], we add it to the odd partial sum the following way: sum[odd] = sum[odd] * 1/4 + 1/2 * dp[5].

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

Why do u write "row" Instead of "consecutively" When u know prob A contains rows and cols

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

How to solve B? It was very hard for a B problem.

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

    Say the sum is $$$S$$$, since we want them all to have the same number of blocks and the pile he chose ends up with $$$0$$$ they will have exactly $$$\frac{S}{n-1}$$$ blocks. So we always have to make $$$S$$$ divisible by $$$n-1$$$.

    The only other condition is that $$$\frac{S}{n-1}$$$ is at least as large as all elements, otherwise since we can't take blocks away that pile would be larger.

    Thus, if the maximum element in the sequence is $$$M$$$ the answer is just the largest of $$$M(n-1)-S$$$ and $$$(-S) \pmod{n-1}$$$

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

      Thanks man , this s/n-1 thing came to my mind but was not able to develop on the thought .

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

      What is the reason behind $$$(-S)(mod \ n-1)$$$?

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

        To redistribute the blocks between $$$(n - 1)$$$ boxes, $$$S$$$ should be divisible by $$$(n - 1)$$$. $$$(-S) \bmod (n - 1)$$$ is the smallest non-negative number that, when added to $$$S$$$, makes it divisible.

        Note that in this case, $$$\bmod$$$ is the mathematical definition of the modulus operation, in some languages (in C++, but maybe in some others as well) the standard modulus operator doesn't work that way (it will not produce a positive result if $$$(-S)$$$ is negative, but $$$\bmod$$$ in mathematics always produces a non-negative number), so you have to add $$$(n - 1)$$$ to the result of this expression to handle it, if the result is negative.

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

    The idea is that if we can use the minimum value of the array to make every other value equal to each other ,then we can do the same for every other $$$i$$$. Let $$$mn$$$ be the minimum value in the array and $$$mx$$$ be the maximum. Then we need to calculate the sum of differences between $$$mx$$$ and every other value different from $$$mn$$$, we can call this value $$$s$$$. If $$$s>=mn$$$ then the required number of blocks will be exactly $$$s-mn$$$. Otherwise, we need to verify that $$$mn-s$$$ is divisible by $$$n-1$$$. If $$$(mn-s) mod (n-1) = 0$$$ then the answer is $$$0$$$, otherwise it will be $$$n-1$$$ minus the remainder.

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

    Just make the sure you can satisfy all the conditions if you pick the box with the smallest number of balls. Because that box is the one with the maximum constraints. Then the other boxes will automatically satisfy the conditions because they will have lesser constraints than the smallest box. To satisfy the smallest box, calculate how much extra balls you require to make every box other than the selected box have the same number of balls i.e. the max.no. of balls in a box.

    If the req no. of balls is less than the balls you have, just make sure that the extra balls are divisible by (n-1)

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

The problems A-D were very good and I enjoyed solving them.

But why sudden steep increase in difficulty for E,F,G

(Looked like Div0.5).

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

how to solve div2 B ?

»
3 months ago, # |
  Vote: I like it -27 Vote: I do not like it

Here is my channel https://www.youtube.com/channel/UCqjcmehldBOz35xUTEr71dg I am gonna soon upload recording of how i gave the contest how i approached A,B,C and succeeded in solving A and C. Will also be uploading video solution for other videos, Like share and subscribe the channel or at least check it out once. Detailed solution and how you could have cracked it too.

»
3 months ago, # |
  Vote: I like it -7 Vote: I do not like it

Solved E in $$$O(n^3)$$$...

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

    how ?

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

    why do you comment about this before finishing open hacking period....

    some guys might hack your code ... hope you for surviving..

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

      After Hack phase, all successful hack tests will append to system tests, so my comment doesn't change anything xD. By the way, I wanna know whether is a right way to brute force or just luck

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

        In fact, i submit hack data to your code.. but even though submitting worst test case, your code is not hacked..

        i don't know why

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

Has someone solved e using ST with arithmetic sequence? I didn't manage to debug it in time.

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

how to solve b?

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

Actually, I like problem B. But I didn't like why the arrangement is A — B — C — D instead of A — C — D — B (More precisely, B is harder than A, C, D because the idea not the straightforward one rather than A, C, and D). Since the target of contestant is Div. 2 user, I think put B in the second problem wasn't a good idea due to the idea is "more cool" than C and D.

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

    I do think so! Actually, after I read B and C, I decided to solve C first because I thought it was the most straightforward between them all... and it was exactly as I thought.

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

any ideas what the 8th pretest for problem E is?

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

It would be better if you would have even allowed $$$O(n^2 \cdot logn ) $$$ solutions in problem E :(

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

    We have written some $$$O(n^2 \log n)$$$ solutions for E, and they pass. Unfortunately, several participants even squeezed $$$O(n^3)$$$ with a lot of optimizations, so perhaps we should've left the constraints as $$$n \le 5000$$$. What is your solution?

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

      I came up with this: iterate on leftmost of the 2 ranges, and initially map each input boundary to leftmost author. Then run a 2nd loop for 2nd author from right to left and keep removing intervals from left interval and move to right interval's DS. But that would required me to use lazy propagation which is very slow. I think with some smart work, it can be done without lazy propagation? or does the solution approach completely differ from this one? Time Complexity would be O(N^2 logN)

      PS : Some N^3 solutions still managed to pass I believe. Also what do you think, would a time limit of 2.5 secs might have been better?

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

        My solution is the following:

        Let's look at two edtiorials as segments $$$[x, x + k - 1]$$$ and $$$[y, y + k - 1]$$$ ($$$x \le y$$$). Suppose there is a guy who wants to listen to problems $$$[l_i, r_i]$$$. Let's look at the centers of these three segments. If the center of the segment $$$[l_i, r_i]$$$ is closer to the center of $$$[x, x + k - 1]$$$ than to the center of $$$[y, y + k - 1]$$$, then the guy should go to the first editorial, otherwise — to the second editorial. It means that if we sort the participants according to the values of $$$l_i + r_i$$$, the prefix of them will go to the first editorial, and the suffix — to the second editorial.

        There are different ways to continue this solution, but perhaps the most simple is to build prefix sums to answer the query "the sum of $$$a_i$$$ on some segment of participants if they go to an editorial starting with problem $$$x$$$" in $$$O(1)$$$. Then we just iterate on the prefix of participants that go to the first editorial, and find the best editorial for the prefix and for the suffix in $$$O(n)$$$.

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

          Wow! Centers of the segments is brilliant! I wrote exactly that but tried some weird comparators. Nice problem!

    • »
      »
      »
      3 months ago, # ^ |
      Rev. 2   Vote: I like it +14 Vote: I do not like it
      • Iterate for the range $$$ [l,l+k-1] $$$ of the first author.

      • For each $$$ l $$$, iterate for the range $$$ [r,r+k-1] $$$ of the second author, where $$$ r >= l $$$.

      • Whenever change range $$$ [r,r+k-1] $$$ to $$$ [r+1,r+k] $$$, remove the participants who will now prefer reading editorials from the first author's range. (They won't see editorials again from the second author for each $$$ r' > r $$$)

      • Maintain 2 segment trees, each having lazy propagation. Update answer by $$$max( ans,Query1(l,l+k-1)+Query2(r,r+k-1))$$$.

      • Participants having $$$ l_{i} = l $$$ will permanently join the first author for each $$$ l^{'} > l $$$, so update the segment tree accordingly.

      • Reset the segment tree of the second author.

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

      98943451 it didn't even use the simplest optimization that iterates j from i+1 :(

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

Solved problem D by finding pattern from sample test cases.

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

Please give One editorial for Two editorial!

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

How i solved B - 1. Let A[i] = number of blocks in i-th block , Sum = A[1] + A[2]...+ A[2] , Max_blocks = max(A[1], A[2],,....A[n]). 2. Let the new array of blocks (i.e after performing the operations ) be A_prime[]. 3. Let Sum_prime = A_prime[1] + A_prime[2]...+A_prime[n]. 4. We know that A_prime[i] <= Sum_prime/(n-1) (because we cannot move elements among different boxes) . Hence we get Sum_prime >= (n-1)*max(A_prime[i]) . 5. Hence the answer = operations we performed = Sum_prime — Sum.

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

Solving E be like...

4n15vj.jpg

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

What sort of optimizations in Problem E for passing O(n^3) solution ??

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

    Just some pragmas nothing else: code

    I really hope somebody finds a hack to these solutions cause its really annonying T_T

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

My solution for B,

Main observation is, If we empty any box the total number of blocks should be divisible by (n-1). Since we cannot remove any blocks we should add some blocks and the sum of all blocks should be divisible by n-1, so we will add some X blocks such that the sum of all blocks will be divisible by n-1. In this case each box will have (initial sum of blocks + X) / (n-1). If this value is greater than or equal to maximum blocks holding box, this is the answer.

But if this value is less than the initial maximum blocks holding box(say MAX), then we cannot arrange equal number of blocks in all boxes. so in this case it is optimal to have that MAX blocks in all boxes.

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

I have faced problem submitting D in last 7 minutes of the contest.Is there anyone who faced the same problem? Or it was just bad luck of me.

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

I felt B was easier than D. I don't know, I just was not able to see the Fibonacci pattern and delved deep into the combinatorics realm.

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

nvm

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

Can someone explain the logic behind using fibonacci pattern in problem D

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

I so much wanted to solve D. Solved it at once after seeing the solution. Damn man

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

What I don't like about D

A lot of people solved it by the "notice the pattern" style without understanding anything about the problem itself. I don't think it is acceptable for the D problem

Also surely B was more difficult than C but that is less of a problem

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

    what is proof of using fibonacci pattern in problem D

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

      No idea actually. I solved it this way

      Just consider the leftmost city . If it is lit (p=0.5), the answer is f(n — 1) If it is not, then neighboring city has to be lit up and then it will also cover the third city

      So f(n) = 1/2 f(n — 1) + 1/8 f(n — 3) + 1/32 f(n — 5) and so on...

      Then I observed that it is just recursive formulae f(n) = 1/2 f(n — 1) + 1/4 f(n — 2)

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

      Can simply use substitution this way:

      f(n) = f(n-1) + f(n-3) + f(n-5).... (1)

      Replace n by n-2,

      f(n-2) = f(n-3) + f(n-5) + ... (2)

      Now from both (1) and (2), f(n) = f(n-1) + f(n-2) which is fibonacci recursive relation

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

    This happens a lot of time, especially with OEISable questions, kind of a shame that they miss out on nice problems but people are desperate to do questions during the contest (ofc I also used to do that), and besides that, I think being able to observe pattern is smart too, so it's acceptable imo.

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

      I thought about OEIS kind problem too while writing the comment . Thank god it was not easily googlable this time.

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

what is the logic for the D question?

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

The C problem was not at all Div 2 C level imo. It could even be compared to A level problem for many div 2 rounds

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

Wasted more than an hour debugging G only because of some extremely stupid mistakes. I can't believe how foolish I am. Really wish I could code more accurately =(

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

Solution Thought On Problem B?

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

In the problem D, everyone used modExp(y, mod-2). why everyone used mod — 2.. I didn't understand.. can you please explain...

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

    to calculate multiplicative modulo inverse.

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

    You want y^(-1) so that y * y^(-1) == 1

    Fermat's little theorem says that if m is prime and a is not divisible by m then a^(m-1) == 1 mod m, then you can see this as a * a^(m-2) == 1 mod m, so a = y and a^(m-2) = y^(-1)

    And using binary exponentiation you can calculate it fast:)

    You can read more about it here https://codeforces.com/blog/entry/72527

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

Very unpopular and complicated solution for D:

Any tower will cover only odd number of points. So lets say we decide to choose $$$k$$$ points and the number of points spanned by $$$i^{th}$$$ point is $$$y_i$$$. Now we just need to solve for number of solutions to the equation $$$\displaystyle\sum_{i=1}^{k} y_i = n$$$ , where $$$y_i = 2x_i + 1$$$ and $$$x_i >= 0$$$. It transforms to finding the number of solutions to the equation $$$\displaystyle\sum_{i=1}^{k} x_i = (n - k)/2$$$ , which is given by the formula $$$\binom{x+k-1}{k-1}$$$ where $$$x = (n - k)/2$$$ and parity of $$$n$$$ and $$$k$$$ is same.

The final answer would be just the sum of all values from $$$k=1 . . . n$$$ divided by $$$2^n$$$. Total time complexity would be $$$O(n*log(mod))$$$. Submission Link

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

    Thnx a lot :)

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

    I was doing the same, was not able to come up with the combination formula.

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

    I was thinking that i am the only who make it overcomplicated this way.But good to see your comment.

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

    Proof that your formula indeed calculates fibonacci numbers

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

      Although in a way, your solution is a proof of a different way to calculate fibonacci numbers because your solution is a different way of thinking about some problem for which the answer is fib(n)

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

in question A.Robot Program ,it was written that not more than 2 or more commands can be preformed in A ROW,so why test cases are made for rows and columns.

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

    They meant no two same operations can be performed consecutively

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

when will the editorial be out for the contest. Thanks!

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

Why don't this (Problem B) give TLE ?

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

    The above solution uses the O(N log N) approach (multiset takes O(logN) for finding, deleting, and adding an element), which easily passes in 1 second under the given constraints

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

      I think you didn't consider the while loop.

      while(have%(n-1)!=0){ // O(n) ?
             have++;
             cnt++;
      }
      

      So overall is O(n^2 logn). Correct me If I am wrong.

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

what is the dp approach for D?

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

    write a recursive solution to find nth Fibonacci number and memoize it.

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

      fibonacci?.. I was solving it 40mins through combinatorics while there was such a simple solution:(

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

        We can observe through the statement that we are supposed to find the number of ways in which n can be represented as the sum of odd numbers.

        We can see that from the below observation:

        Now, if there is any tower with power $$$P$$$ then it can provide signal to the right $$$P-1$$$ cities and the left $$$P-1$$$ cities and to itself. So, each such tower will provide signal to $$$2P-1$$$. Also, note that each city should get signal from exactly one tower. Consider if choose x cities with each having power $$$P_{i}$$$ then we have,

        $$$n={\displaystyle \sum_{i=1}^{i=x}(2P_{i}-1)}$$$

        Using the above observation, we can easily deduce that we are required to find the number of ways in which n can be written as the sum of odd numbers. Now we can easily check the probability of every single case is $$$p=\frac{1}{2^{n}}$$$ and x = number of ways to represent n as the sum of odd numbers, we get final answer as $$$xp$$$. Rest is just left to use MOD operations wisely to obtain the final answer

        To find the number of ways in which n can be represented as the sum of odd numbers uses the dynamic programming approach.

        Base cases are: $$$dp[0]=0,$$$ $$$dp[1]=1$$$

        The recursive relation here is: $$$dp[i] = dp[i-1] + dp[i-2]$$$

        Proof for the recursive relation:

        (1) $$$dp[n] = dp[n-1] + dp[n-3] + dp[n-5] + ... $$$

        Also,

        (2) $$$dp[n-2] = dp[n-3] + dp[n-5] + ...$$$

        Therefore, using (1) and (2), we get,

        $$$dp[n] = dp[n-1] + dp[n-2]$$$

        Hence, $$$x=dp[n]$$$ and $$$y=2^{n}$$$

        P.S Don't forget to use the modulus operations wherever necessary.

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

In problem D , i didn't reduce the probability fraction to irreducible form , but it got accepted. Should this not affect the final output ?

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

    Yes,it shouldnt make any difference because as much as I remember , the condition is that denominator and the modulo should be coprime and denominator is only the power of 2 in the problem and modulo is a prime no.... BTW , I hope you remember (x/y)%mod=(x*(1/y))%mod=((x%mod)*((1/y)%mod))%mod.

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

      Which condition do you mean here :

      " the condition is that denominator and the modulo should be coprime" ?

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

        The condition for modulo multiplicative inverse

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

I think A,C,D were much simpler than B..... Its just my opinion

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

https://youtu.be/BauOvXZOmL0 I solved B using Binary Search , give it watch if you want to.

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

Any ideas for problem G?

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

    The main idea is the following. Consider some starting vertex $$$v$$$ for Bob. Bob can make at least $$$x$$$ moves from this vertex if there exists such a vertex $$$u$$$ that the distance from $$$v$$$ to $$$u$$$ is not greater than $$$x$$$ and the distance from any Alice's marked vertex to $$$u$$$ is greater than $$$x$$$. The rest is multi-source bfs + centroid + possibly binary search (there is a solution in $$$log^2$$$ and a smarter one in $$$log$$$).

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

Can anyone tell who is rainboy (sorry for unnecessary tagging)? I am just amazed to see his/her performance. He/She starts from last and does the most difficult problem which has only 5-10 submissions and then leaves the contest, whereas he/she could rank $$$1st$$$. He was an international master before and now just specialist. Does he/she do that on purpose or is there some other reason. P.S.- Rainboy ranked 6th by completing the last 2 problems. Rainboy ORZ

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

    He is probably another Karan gujjar.

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

      Please don't compare that shit with this guy. This guy is really really good. Was just confused of why he uses this strategy.

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

        I guess his main focus must be competitions like IOI, ICPC, where speed isn't given that much of an advantage over problem-solving. So, my guess is that he starts with the hardest problems because those are the level of problems that you would expect in such competitions, and also he must not care about rating at all :)

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

    Maybe to create a nice rating graph

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

Just now, a friend asked me what happened to Master purinliang. I said "What was going on?" and then he sent me some screenshots.

I took a look! Ouch! It turned out to be yesterday. There were five young people, all rating more than 1900 points, and two rating more than 2400 points. They prepare a round named "Educational Codeforces Round 98", and I am very glad to join it.

However, the Problem A using a confusing vocabulary "row". I think that "Wa! There is a chance to hack others!" I coded that

if(x <= y + 1) {
    printf("%d\n", x + y);
    return;
}
printf("%d\n", x + x - 1);
return;

A "Wrong Answer" suddenly attacked to hit my face. Ouch! I was very careless and didn't dodge, Ouch! It is not good, I advise myself "Rat tail juice"(it means "Behave yourself" in chinese), and reflect on it, and stop making such cleverness in the future.

Ah, "Educational round" should be based on peace, coding ethics, and no hacking in the room! Thank you my friends!

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

Can someone help why my solution for problem B 98926905 got hacked.

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

    Why did you use while loop that has cost you? While loop will cause time limit excedded

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

      Yes, I should have given more thought while implementing this.

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

    This part of the code highlights the flaw of your solution. Before you take a look at the explanation, see if you can find why there is a flaw.

        while((n-1)*mx<sum){
            mx++;cnt++;
        }
    

    Explanation: In this while loop, the incremennts keep running until the condition in the while loop is no longer satisfied. In most test cases, this while loop only repeats for a limited amount of times, so time is not a major concern. However, in the hack testcase, (n-1) * max is 2 billion, while sum is 3 billion. In order for (n-1) * max to be greater then or equal to sum, max would have to be incremented 500 million times to exit the while loop. When there is a total of 1000 cases of this type, there simply isnt enough time to increment the variable 500 billion times. (500 million x 1000 cases)

    How this can be avoided: Be careful with while loops because the execution will never leave the while loop until the condition is no longer satisfied. If there is a possible case that could make that while loop run forever or run a very large amount of times, see if you can find a way to remove it. Here, a max function can replace the while loop (and thus fix this flaw).

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

      Ok. I should have given more time while thinking about the solution. As soon as it passed the sample test, I immediately made the submission. I think it would have anyhow failed the system test. Also my logic has a flaw, I could have made a better solution. Anyway, Thank you for your explanation.

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

      I have made a new submission. Is there a way to run my new code on the test which was used to hack my solution?

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

        You do not need to worry about that, since all successful hack's test cases(including yours) are added in the test cases that is used for practice submissions.

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

How to solve problem B?

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

how to solve problem E?

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

Good round :)

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

whats wrong with my solution for problem c? my concept was to run two loops

create a bool array which denotes which element is deleted and which is not and then check accordingly

check the ith character if its false which means not deleted then check for the j th character and if its also not deleted then check whether they form RBS and update the ans and delete them.

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

    You're still considering using the same ( or [ after you have counted/deleted that one before.

    As the problem description stated, you can only count/delete the pair once.

    A tip for your algo maybe you can break the inner loop after you found the pair, and move on to find the next pair.

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

      thank you for the reply

      but i dont understand

      i am deleting the character once it is counted, to do so I am using the bool array like if a[i] is true(that means character at i th position is deleted) then i will not go for the inner loop

      and if a[i] is false then I check for a[j] if it is false then only the contents of the inner loop is executed, once the pair is formed i delete both the character by marking them true;

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

      okkkkkkkk i got it what you are saying. and i used ur suggestion of using break but now its showing tle on tc 8:( thank you for the suggestion now i have to do something about tle thing

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

        No problem, it's my pleasure.

        As for the TLE, it's because your algo works in O(n*n) which is really slow for this problem, because the string's length for overall test-cases can be up to 2 * 10^5. I suggest you to find a new solution that works in linear time O(n).

        Good luck!

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

It's soo much of wait for rating changes in rounds having 12 hours of hacking phase!

»
3 months ago, # |
  Vote: I like it -13 Vote: I do not like it

Was this round rated ??

»
3 months ago, # |
  Vote: I like it -6 Vote: I do not like it

do comments add up for contributions ?

»
3 months ago, # |
Rev. 2   Vote: I like it -12 Vote: I do not like it

[Deleted]
It seems that I still have to wait...

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

    They will change after system testing.

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

      Err... Alright.

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

      Isn't system testing already completed?

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

        Its takes a little while for it.. I guess ratings would be done in a hour or so as per usual trends

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

When will the results of this round show in division 2 users rating..?

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

long queue only for B problem

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

Why did my rating not change after this contest

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

when the tuitorial come out?

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

When will the ratings gets updated ??

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

Looking forward to Rating changes & Editorial!

»
3 months ago, # |
  Vote: I like it 0