SlavicG's blog

By SlavicG, 3 years ago, In English

Hello Codeforces!

mesanu, flamestorm, MikeMirzayanov and I want to invite you to Codeforces Round 799 (Div. 4)! It starts on Jun/14/2022 17:35 (Moscow time).

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 the testers: Neophiliatic, Qualified, sandry24, _Anurag, jampm, TimDee, Olympia, hbarp, AlperenT, BucketPotato and VIP-tester _Vanilla_.

And thanks to NEAR for supporting this round, details can be found in this post.

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

Good Luck!

UPD: Editorial is posted!

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

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

As the tester I want to say

orz orz orz big great SlavicG thank you for dib4 div 4 div orz

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

I wait it

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

Good luck for Everyone

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

As a tester, get SlavicG to top 10 contributors by upvoting all of his blogs.

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

As a VIP-Tester, I can guarantee that nobody's life was endangered prior to me getting this role.

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

    As a tester, I can guarantee that vanilla is beneficial for health.

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

      As a VIP-Tester, I can guarantee that eating vanilla icecream will give you positive delta.

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

I love div.4 rounds. Good luck for everyone who less than 1400**!

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

    You talk more than you do

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

      Damn bro that's actually rude

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

      Who told you I don't work hard every day !? I am a student in grade 8 so most of time is gone in studying! I have no time to code every time, but I do all my best to become a specialist.

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

Good luck for everyone

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

Thankyou to all the testers and problem setters, and good luck to everyone

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

Another Div-4 Round, thank you! I love these kind of problems!

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

Good luck in lightspeedforces round

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

If anyone knows the real name of Lemon Sunomono tell pls.

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

Last 2-3 contests were so difficult, I hope I do good in this one and get back to green.

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

I look forward to give my first contest in Java, which I learned recently :)

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

my first contest me as a unrated participant :)

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

This is my first contest as an unrated participant...Good luck everyone!!

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

Prepare for the memes about specialists being unrated :/

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

Thank you sir for organizing div 4 contest.I always love div 4 problems.I think all beginners also love div 4 problems.

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

If someone is currently Specialist and is going to become Pupil after the end of Educational Round 130, should they register now and be *out of competetion, or wait for delta change and then register in competetion ?

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

    wait for delta change and then register in competition, because maybe you'll get positive delta in this round.

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

First unrated round for me, feels good!

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

What happens if someone is pupil and becomes specialist in the previous round but registers for this round as a pupil, will the contest be rated for them?

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

GOOD LUCK EVERYONE:) HOPE I'll able to solve 2+ problem in this contest;)

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

If I cannot make to specialist tomorrow, I will shave my head.

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

    Post it if it happens

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

    please post, I'm dying to see this

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

    adding you to see your performance

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

    Sorry everyone, I have done my best, it's midnight here, I felt my head is going to explode:( Still can't tackle H, why am I always missing a problem to AK a Div.4 Round? Maybe I can't reach cyan, I will post the pic later:)

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

    you made it! well done

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

First unrated contest for me.

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

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

My first unrate contest OwO

P.S. Good luck for everyone.

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

    I'll be a specialist, when they will give a rating for Educational Codeforces Round 130 (Rated for Div. 2)

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

      You sure? System testing for that round isn't done yet and your solution for C is O(n^2) imo, so your solution might TLE. P.S.- I hope you pass though :)

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

I wanted to add VIP tester _Vanilla_ as a friend, but he is currently a friend of 69 users.... so I'll let it be for now

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

    Wise decision, breaking such balance would bring chaos upon our universe.

    UPD: It seems like someone has already done it. The legend says he will have negative delta for the rest of his life.

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

Good luck everyone , hope this would be a fun and interesting round to be participated in.

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

leetcode monthly contest?

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

    Actually some leetcode contests are harder than this.

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

![ ](IMG-20220613-223340)

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

My first unrated round :)

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

first contest as an unrated participant

GOOD LUCK TO EVERYONE!

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

"take part in at least five rated rounds (and solve at least one problem in each of them)"

Is it some new feature? I can't remember the same thing being about a year before. Especially because my rating has been changing since my first rated contest.

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

What are the hacks? What can participants do? Sorry, maybe dumb question, but I am first time here

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

    You can view other people's solutions and find a test case that makes their code fail, that's hacking

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

As a tester, I can assure you this is going to be one of the best div4 round till now, congrats to the problem-setters for the great problems, and I wish yall good luck!

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

Will Try to Finish it under 40 min. Previous record is 50 min. Let's see if we can break it Today!!

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

    Well seems like it wasn't speed forces after all.

    I really loved problem H.

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

      Yeah i came late and got stuck on H because i am a retard clown whose always do the silly mistake everytime. i liked problem H i have solved this type of problems before a lot. So for me i was doing nothing new as implementing what i implemented before.

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

Does anyone have a problem with the dollar sign in problem page all brackets sees like $ sign.

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

Hope every want to be Specialist can be Specialist.

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

Difficulty:

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

Once again, if you are not sure, I will say as tester — this round is really fire, it's one of the best quality rounds of last months, and best div4 I ever took part in. I suggest everyone reading all problems (even Blue-Purple-Yellow-Red participants). Good luck and have fun writing this contest.

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

First unrated :D

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

hopefully, I will motivate again for this contest. thank you for arranging div4 for the newbie

»
3 years ago, # |
  Vote: I like it -28 Vote: I do not like it

Downvoted. DIV4 SHOULD DISAPPEAR!

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

2 hours 15 minutes sounds like a slightly harder round... interesting.

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

    Just for my curiosity, was it really harder in your opinion? When I tested problem H seemed very respectable :D

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

      Yeah, feels like H was around 1600-1700 rated in terms of implementation and apart from that I really liked how creative D and F problem were.

      This time it was a different Div. 4 round :)

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

Can I register lately?

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

Rip cfsubmit didn't work properly for me when submitting to problem C, costing me 4th place :(

Nevertheless, I clutched 6th place with a meme screencast: https://www.youtube.com/watch?v=Aw_U6cnUh-0&ab_channel=JoshuaChen

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

Very educational contest! This is the type of Div 4s that enjoy participating in.

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

the last problem is very nice, kudos to the author

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

Nice H..

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

Nice contest! For those who are interested, my screencast and solution explanations to all problems will be available at https://www.youtube.com/secondthread as soon as the contest is over.

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

    Can you do this for more rounds that you participate in?

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

nice round, F is interesting

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

Enjoyed the round. Thanks to the problem authors! :)

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

Awesome contest, Nice set of problems !! Thanks to the authors <3

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

I choked F lol. I missed $$$7 + 7 + 9$$$. Cost me 3 penalties...

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

H was nice

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

I was trying to solve the E problem with 2 pointers by making an array of indices where there are 1's and calculating the difference and moving accordingly. Was I correct ??

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

can someone tell me what am i doing wrong here for question F

https://mirror.codeforces.com/contest/1692/submission/160638148

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

    First, explain your logic, and then I'll check it.

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

      sorry for downvoting its pressed by mistake

      here I first make frequency array of remainder than I go to each case such that on adding it gives either 3 or 13 or 23 than i check if it is possible by checking their frequencies

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

        The approach is right,just move case(x==y && y==z) to the first place because it will never execute when x=y or y=z or x=z;

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

I believe that this was the perfect div. 4 round! Problems were educational and of perfect difficulty.

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

I get 4000-5000 ranks in div2 and 12000 in div4 feels like hell:°(

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

Can someone please tell me what's wrong with my two pointers solution for problem E? 160627514

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

    Explain your logic and variable names first, and then I'll check it.

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

      thanks bro. "i" stands for pointers from the begin, and "j" for the end. Bufa is the number of 0 from the begin while bufb is from the end. The two pointers would increment 1 generally. In the meantime, one would check wether the other pointer can get a 1 with lower 0 counts.

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

loved problem F. not because of the problem, but because of the name ;)

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

cf definitely hates me, just because i put 3 instead of 4 got WA on test 1 (the WA on 8 was because of l)

i would've got specialist :/

first and last code compared
  • »
    »
    3 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    bro if your code will fail test cases then you will only get WA nothing like hates or something.

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

Congratulations to authors for problem H!Very interesting!

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

What is wrong about my code of Problem C

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

    if(ans[i][j]='#'), should be ==. You can even remove that if.

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

why map gave tle in b?

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

    If the size of map is n,each times,the time of useing map[i] is log(n). I see your code,even the map[i] is 0,u search it.This need log(n) to modify the map and log(n) to query. I advise u to use for(auto it:'map's name') to query each in map.That will avoid insert and modify the map[i] that == 0. What's more u only need to know the number of the kind.So set would be a better choice. The ans is the size of the set.And if (n — ans) is odd,u have to ans--,since u can only remove two numbers each op. Here is my submission that use set to slove:160536879

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

Hello people,

I couldn't figure out what's wrong with my code for problem C. I would appreciate any guidance,help, answer or hint in order for me to correct it.

https://mirror.codeforces.com/contest/1692/submission/160649178

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

    I think that the input() in python also reads blank lines, so when you try to iterate from 0 to 7 produces runtime error. Also in your answer you don't put an space between str(outputs[k][0]) and str(outputs[k][1]). But the logic is perfect, it's simpler than what I did.

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

      Hello, thank you for your response

      I just update my code according to my understanding of your idea added another input line for blank line (it has been said that input cases should be seperated by a blank line) but I'm still having the same issue. Could you propose an adjustment to it please.

      https://mirror.codeforces.com/contest/1692/submission/160663411

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

        In the case of:

        3 <- num of test cases
         <- empty line
        ..#...#. <- line with 8 characters
        

        The program will fail in the second line, because when you do array_elements = [array_elements[i] for i in range(0,8)] you will have an out-of-bounds error, because len(array_elements) is zero.

        So we want to ignore empty lines, no matter the position, for this I simply add a while loop:

        array_elements = "" # empty string
        while len(array_elements) == 0:
            array_elements = input()
        

        I don't believe this is the adecuate method because I don't program in python, but it solves you error

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

I tried to hack a submission of H, but the judge returned 'Unexpected verdict'. is it my hack's failure ? or judge's?

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

There are some Unexpected verdict in the Hacks of problem H.

This blog said that it's because one of the solutions marked on Polygon as Correct can't pass the hack data.

Please fix the problem.

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

I'm curious why it's rated for everyone rated less than 1400 whether or not they are a trusted partipant? Someone rated >= 1400 can create a new account just before the contest and ruin the ratings of Trusted participants right? SlavicG mesanu flamestorm MikeMirzayanov

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

    No. The contest is rated for everyone less than 1400 but only official participants are considered while deciding the actual delta. So new accounts won't have any effect

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

      Then how will the delta for non-trusted participants be calculated?

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

        If I'm not wrong, all new accounts have a 1400 hidden rating at the start. For the first 5 or 6 rounds, you are gaining additional rating points which sum is equal to 1400 (that's why you can solve 0 problems but receive something like 357rating) + normal rating delta for the account that started with 1400 points.

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

          No, not anymore! These days new users start with a rating of 0 and not 1400.

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

Problem H was a nightmare for unordered map users. Also idk why a lot of python users are getting hacked in this problem.

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

Amazing round, my first time solving all problems,even though the last one only after the contest. Great feeling!!

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

What is the case of 73 of test 2? Not accepted, someone help me please. 160678922

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

    Explain your logic and variable names

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

Understood the method, found out about Kadane's algorithm!

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

Can anyone please point out the error in my code/logic (Problem G). I used a sliding window approach by making a window of size k. The variable bad used in my code tells the last index till the current index where the inequality does not hold.

My submission
https://mirror.codeforces.com/contest/1692/submission/160622089

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

    You can try this case:

    1
    10 3
    1000 20 10 5 9 10 11 12 13 14
    

    Answer is 4 but your solution output 6.

    I found that you will break after finding the bad position for the first time, which causes if there are multiple bads in the length of k, you will only find the first one

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

    Now I changed your code :

        f(i, 1, temp.size())
        {
            if (2 * temp[i] <= (temp[i - 1]))
            {
                poss = false;
                bad = i;
                //break;
            }
        }
    

    And Accept 160742816.

    It's a good idea, just didn't notice the details

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

Is there any indication of whether the regrade has happened yet?

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

I think this is the longest time I waited for rating change

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

    are you expecting a colour change?

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

      Intially I expected that I'll be Cyan for my rank and number of participants but realised It doesn't happen in Div4 and now you are seeding doubt for even green colour change

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

        even I am waiting for my color change. But now it seems like this competition was maybe unrated. IDK though

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

          Congrats for your Color Change :)

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

...

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

Is it possible that a person less rated than other one and has got more rank in the contest than the other one, after rating change become more rated than other one??

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

    Yes, if that contest of more ranked participant is still less than or equal to 6