SleepyShashwat's blog

By SleepyShashwat, history, 7 weeks ago, In English

Henlo Codeforces! ^_^

I invite you to participate in Codeforces Round #663 (Div.2) taking place on Aug/09/2020 17:35 (Moscow time). The round is rated for users rated less than 2100, while other users can participate non-competitively.

The round features five problems, and you have 2 hours to solve them. There may, or may not, be an interactive problem; regardless, you should know how to deal with them.

I would, now, like to thank–

Please do not mind the long list of testers (I had to write code to tag everyone here) since the problem set changed significantly after the first round of testing.

We will announce the scoring distribution shortly. The scoring distribution is 500–750–1250–2000–2750.

Good luck, and stay safe!

UPD: Editorial

Here are video editorials by BRCode:

UPD2: Finally, congratulations to the winners!

Div. 1:

  1. tmwilliamlin168
  2. risujiroh
  3. fanache99
  4. LayCurse
  5. Heltion

Div. 2:

  1. 00000010100001100111
  2. PouyaNavid
  3. 420iq
  4. I_want_2100
  5. silxi
 
 
 
 
  • Vote: I like it
  • +1305
  • Vote: I do not like it

»
7 weeks ago, # |
  Vote: I like it +148 Vote: I do not like it

As a tester I think people will like this round because of interesting problems,diverse topics and short statements

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

    Also (as a tester) wants contribution :)

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thanks, I see a lot of orange here in the group.BTW what's polygon, I read it in every announcement MikeMirzayanov for Codeforces and Polygon platforms– Polygon is truly remarkable!

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

      Polygon in basically the platform for creation of programming contest problems. It also supports problem statement writing, test data preparing, model solutions, judging and automatic validation.

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

    Hope there are strong test cases this time. :P

  • »
    »
    7 weeks ago, # ^ |
    Rev. 2   Vote: I like it -16 Vote: I do not like it

    how can i increase my rating

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Just after reading SleepyShashwat I am feeling sleepy

»
7 weeks ago, # |
  Vote: I like it +162 Vote: I do not like it

As a tester... Damn there's so many of us!

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

OMG!!! another "as a tester" comments "/

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

    But we can't disagree many of them gives us some useful information about the round.

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

      Anus1373 , I understand the first part of your username butt why do you like 1373

»
7 weeks ago, # |
  Vote: I like it +217 Vote: I do not like it

Which ponies are we helping this time?

»
7 weeks ago, # |
  Vote: I like it +522 Vote: I do not like it

Omg Indian round! So excited

»
7 weeks ago, # |
  Vote: I like it +47 Vote: I do not like it

*insert cringe proud indian comment here *

»
7 weeks ago, # |
Rev. 3   Vote: I like it -28 Vote: I do not like it

0

»
7 weeks ago, # |
  Vote: I like it -32 Vote: I do not like it

I hope, we don't have to help Ponies, in this contest, unlike Previous Contest! :|

»
7 weeks ago, # |
  Vote: I like it +109 Vote: I do not like it

Hope the problem statements are made while you are not sleepy.

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

    Well he was, but I made sure they are alright ;)

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

Memes/images should be posted in spoiler!

Indians on CF
As a tester...
How to feign consumer satisfaction to investors
Anton rounds

Disclaimer: The memes aren't specifically for this round, that's for you to decide :) I liked it a lot as a tester.

»
7 weeks ago, # |
  Vote: I like it +28 Vote: I do not like it

So we'll have video editorials too this time?

»
7 weeks ago, # |
  Vote: I like it +11 Vote: I do not like it

orz

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

As a participant, all we want is short and clear statement. Hope we won't get disappointed :)

»
7 weeks ago, # |
  Vote: I like it +32 Vote: I do not like it

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

Props for the 3b1b style video editorials! Sounds really cool, will definitely watch.

»
7 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
»
7 weeks ago, # |
  Vote: I like it +30 Vote: I do not like it

As a pony , I hope I'll not find any problem about ponies :(

»
7 weeks ago, # |
Rev. 2   Vote: I like it -50 Vote: I do not like it

Don't downvote sir

»
7 weeks ago, # |
  Vote: I like it +39 Vote: I do not like it

SleepyShashwat, AwakeAnay, AsleepAdhyyan, and RestingRajarshi.
Coincidence!? I think not. ;)

»
7 weeks ago, # |
  Vote: I like it +80 Vote: I do not like it

BRCode for making 3b1b-style video editorials of the problems!

YouTubers who make video editorials after the contest
»
7 weeks ago, # |
  Vote: I like it +17 Vote: I do not like it

I'm wondering why almost half of the recent contests, including this one, contain $$$5$$$ problems, but not $$$6$$$.

  • »
    »
    7 weeks ago, # ^ |
    Rev. 2   Vote: I like it +22 Vote: I do not like it

    As a tester you will know why 5 is enough :)

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

      I won't be wondering any more if I can have a chance to be a tester

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

    Because , by excluding 1 problem from 5 contests ,they can create a new one.

»
7 weeks ago, # |
  Vote: I like it +21 Vote: I do not like it

Is this the quartet of last year's IOI from India?

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Curious to know, how many problems/ideas got rejected in this round.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

"Henlo" ?

»
7 weeks ago, # |
  Vote: I like it +14 Vote: I do not like it

Hopefully the ponies are grazing grass instead of playing chess coloring games with each other.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I hope we are not going to have weak pretests like the previous one

»
7 weeks ago, # |
  Vote: I like it +2 Vote: I do not like it

Happy to see an Indian round Again. :D

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

Not as a tester I hope you good luck!

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Wait did I read it right that there are vedio editorials ? Cool.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope that this round has short statements and strong pretests. I am still trying to get back from the trauma of previous round.

»
7 weeks ago, # |
Rev. 2   Vote: I like it -6 Vote: I do not like it

An Indian round with so many testers (and no more ponies and their stories) !!So excited.

»
7 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

How many testers do you need?
-YES!
How many pony stories do you need?
-NO!

»
7 weeks ago, # |
  Vote: I like it +6 Vote: I do not like it

I hope this round will not test our English comprehension skills.

»
7 weeks ago, # |
  Vote: I like it -18 Vote: I do not like it

Why is every div2 round having 5 problems now? Is making 6 problems too hard or are you sleepy while writing problems as well?

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

    I prefer 5 problem rounds. They have better problems.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

(I had to write code to tag everyone here) : How does one write code to tag people? O.o

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope the statements are not sleepy.

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

As a tester i want to say that the contest is shit!!!! Thankfully i am not participating in this officially!! sighs: All the specialists brace yourself!!

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Typo in spelling of Hello Codeforces Please change Henlo --> Hello

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

With this amount of testers

Hope for stronk pretest and programming test, not English test.

Thx.

(and 3b1b editorial seems nice!)

»
7 weeks ago, # |
  Vote: I like it -17 Vote: I do not like it

Although your Indian English is kinda weird, but the 3B1B-style video is so fantastic!

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

Why am I getting a feeling that this is going to be a MathForces round? I hope it is not though! :P

Also antontrygubO_o as a coordinator (Yay! :D)

»
7 weeks ago, # |
  Vote: I like it +68 Vote: I do not like it

»
7 weeks ago, # |
  Vote: I like it -15 Vote: I do not like it

Henlo Codeforces! ^_^ I think here must be "Hello" ^_^

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

    No, they didn't misspell Henlo is a cute puppy language style for saying Hello.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Another contest!! As a regular contestant, I need a break :'(

»
7 weeks ago, # |
  Vote: I like it +31 Vote: I do not like it

As a contestant, I want rounds with aryanc403 as the author

»
7 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

I really starts enjoying memes here...

»
7 weeks ago, # |
  Vote: I like it +6 Vote: I do not like it

Thanks , Codeforces!!!

»
7 weeks ago, # |
  Vote: I like it -15 Vote: I do not like it

author, how could you misspell the word ,,Hello''? i want to cry((

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

Did any tester test anything with Python? Did someone spend the 10 minutes checking if the standrad solution in Python doesn't get TLE or too much memory?

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

    Advise as a community member, You should never worry about TL issues in an Anton coordinated round.

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

Hope the statements are clear. I don't want to walk around the maze :)))

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

soo, if i utterly fail to do the questions then what will happen? (my rank is 0 , will to in minus or increase if yes then how?!

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    If you don't have a submission then rating will be unchanged.

    If you make at least one submission but solve 0 then rating may increase for new users.

    Check Here for details.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks , Codeforces!!!

»
7 weeks ago, # |
  Vote: I like it -21 Vote: I do not like it

As a tester I think people will like this round because of interesting problems,diverse topics and short statements. Thanks, Codeforces!!!

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yeah.there will also be thought-provoking questions

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

SleepyShashwat please don't sleep during the going contest

»
7 weeks ago, # |
  Vote: I like it -16 Vote: I do not like it

Looking forward to a good round after a not-so-good round.

»
7 weeks ago, # |
  Vote: I like it +15 Vote: I do not like it

Happy to see Indian School Students doing great on Codeforces and other CP Platforms! I wish, I also knew about CP while I was in School. Indian Students need to learn that "Apart from IIT JEE, there is also a world called CP". All the best SleepyShashwat for your future endeavours!

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

    Awwwwwwwww, Were you not able to clear JEE, you poor soul

    • »
      »
      »
      7 weeks ago, # ^ |
      Rev. 23   Vote: I like it +24 Vote: I do not like it

      Poor Soul thinking that only a JEE Failure would write that statement. I think you are in the First Year of an IIT or you are not an IITian. Only some First Yearites(Fachas) at IITs have this attitude that they have cleared JEE and won the world OR this attitude is shown by Butt Hurts who couldn't clear JEE Advanced!

      • »
        »
        »
        »
        7 weeks ago, # ^ |
        Rev. 2   Vote: I like it -40 Vote: I do not like it

        What if i say i am in third year in an IIT ? What shitty explanation will you give then ?

        In my college "fachas" or first years, whom you are saying shit for no reason, are better than you in CP.

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

          I have seen people mention IITJEE many times before . So , does this university conduct some kind of computer science competition like I.O.I. , because I have seen it quite a few times like on this blog , Indian contest blog , cheater blogs and some ICPC blogs .

          Its a rare thing for universities getting mentioned so it kind of made me curious

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

            IITJEE is engineering entrance exam of physics, chemistry and maths which is considered to be one of the most difficult entrance exams in the world.

            Top rankers in this exam pursue computer science in IITs not because they have interest in IOI or ICPC only because their parents saw headlines in newspapers telling some CSE grad from IIT secured this much package at google or is now CEO of this company blah blah which is big deal for middle class indian society as most other jobs in india are very low-paid.

            Also indian pupils are dumbass as there was no need of mentioning IITJEE in this blog in the first place

      • »
        »
        »
        »
        7 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        LOL you are from IIT and still a pupil after one year. You must belong to one of the "special" communities.

      • »
        »
        »
        »
        7 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        The only reason i am offending you is you tried to offend those students who busted their ass in getting a f***** IIT after like 2 years of rigorous studying ( maybe 4 years for some ) and you are into CP for like one year and still nowhere with CP ( to be honest ).

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

          I am also in the third year. And to be honest, you can check my submissions, I only gave contests till December last year. Many first years are better than me in my college also. They are Masters and it happens in all IITs I guess. I know I am nowhere in CP and it doesn't even matter to me. And what I have tried to say is there is a world apart from JEE also- for those who couldn't clear that! We also do CP only to get Jobs in MNCs and they also! I also spent 2 years in rigorous studies and I know that situation. And for your kind info, you are wrong even at judging my "Special and Reserved Community" LOL!!! It is just that some need more time doing CP some don't need that. Some do CP continuously and daily while some don't practice that much and I belong to the second one. I don't practice that much because everyone has different priorities. CP is a backup for some to enter the software/IT sector. They may want to do something else like Management, Civil Services, etc. And there are many such IDs on Codeforces- belonging to IITians, a general category and Pupil/Specialist. So, keeping all factors in mind stop judging people! And for your kind information, study for Internships rather than trying to offend me! And I didn't call first years SHIT. It was you who misinterpreted it! I just said they have that kind of feeling in mind in first years. But second-year onwards they know the situation :P.

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

      or he might have cleared JEE

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

      I cleared JEE but wish I'd rather got to know about CP back in school. I have been good at programming since I was in high school but thanks to the JEE culture in India I never got to know about cp.

      Whats worse, I got to know about cp only in my third year and I have only 1 year in my college life left now. Honestly if i could go back in time, I would tell my earlier self to do CP rather than jee.

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    What is IIT JEE ? Is it something on the lines of web development or something like that

    • »
      »
      »
      7 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      it is the exam conducted to select students for studying in the most prestigious colleges of india (IIT). and no, u need to learn physics, chemistry and maths to crack the exam and secure the highest ranks possible to take up computer science(which is one of the many streams taught in an IIT).

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

        So are students not aware about cp or they choose not to pursue it

        • »
          »
          »
          »
          »
          7 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I feel very sorry to say that but the education system in India is totally weird. I hear the word "CP" just some months before(after going to college). When we were in standard till 10. We have absolutely zero knowledge about programming(and we taught in school is totally theoretically especially in CBSE Board(I am from CBSE). In countries like Russia, people start programming in a very early age. They have much more knowledge than us. (Prooving my above statement, Currently there are only 7 red coders from India despite having the largest number of active members in Codeforces(almost double than any country).I am from India, and I really feel for it!!!

          • »
            »
            »
            »
            »
            »
            7 weeks ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            you mean that we have not started cp early, so we are not talented as other country's people?

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

              Yes, this is the only reason I can think of!

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

            Don't feel such. "CP" is not everything. CP just make your approach analytical and logical. Just like a brain exercise. But JEE is where you can do it with extra knowledge. CP makes you better at problem-solving but JEE is really good make strong your fundamentals. Especially I love physics. I love CP too. But I think Physics is always good to explore :)

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope that statements are simpler this time

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

I hope I will not sleep during the contest!!!

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Thank you.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Score Distribution?

»
7 weeks ago, # |
  Vote: I like it +28 Vote: I do not like it

where is editorial for this round?

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

codeforces helping a lot to many students

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by SleepyShashwat (previous revision, new revision, compare).

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I hope the problems will be interesting.

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

very excited for round.

»
7 weeks ago, # |
  Vote: I like it +2 Vote: I do not like it

Very excited for the indian round :)

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

woweeeeeeeeee! 3Blue1Brown style editorials.

»
7 weeks ago, # |
  Vote: I like it -6 Vote: I do not like it

Half of the coders are giving Goldman Sachs aptitude test now lol

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

    Is it necessary to post it here ?

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

      Just felt like posting man. Everyone posts irrelevant memes, so why not this. Anyways, I apologise I said something wrong.

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

        That's true about irrelevant meme. But what I am saying here is we should try to avoid posting irrelevant stuff here. Is someone is committing some mistake, it doesn't mean that we should also right ?

        • »
          »
          »
          »
          »
          7 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I think you misunderstood. I said, many are busy giving the test so, may not appear in this round. Thats what I meant :}

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    What's the lol for ? I genuinely can't find a reason to laugh at that ...

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

This feels quite opposite of previous round...

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I can't understand what 'even length square sub-matrix' means in problem D.

Does it mean a sub-matrix with even width and even height?

Thanks

@SleepyShashwat

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    A binary matrix is called good if every even length square sub-matrix has an odd number of ones.

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It is described in the sample explanation below the testcases

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

Problem B was too easy , should have been a little harder...

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

After solving A and B what should be the best thing to do?

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

»
7 weeks ago, # |
  Vote: I like it +11 Vote: I do not like it

Me after solving A and B :-) after-AB

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

Permutation lover SleepyShashwat

»
7 weeks ago, # |
  Vote: I like it +19 Vote: I do not like it

From today, I started loving permutations because no one knows how you can play with permutations except the master SleepyShashwat. Truly a good and well implementation based round. Only DS can help :)

»
7 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

The problem statements were really nice :) But the difficulty could have been a bit higher for C.

»
7 weeks ago, # |
  Vote: I like it +17 Vote: I do not like it

Determine if the contest is good?

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

    If Tx is the number of people solved task x, then the contest is good if Tj < Ti for any j > i

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

      For now, 13045 — 12108 — 5115 — 1169 — 61.

      • Accepted!
»
7 weeks ago, # |
  Vote: I like it +13 Vote: I do not like it

My JEE notes help me in solving question C

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

Now this is what I call a Contest. loved it. Kudos to the author.

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

Nice problem set! A good round after a long time :)

»
7 weeks ago, # |
  Vote: I like it +11 Vote: I do not like it

Waiting for the end of the contest to start discussing the task E

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

    PATH: if diameter of graph >= (n+1)/2 ^) PAIRING: if otherwise, but how to construct?

    • »
      »
      »
      7 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Do dfs. In dfs tree if there is a path from root to any leaf with length >= (n+1)/2 we have solution PATH. Otherwise we pair nodes at same depth/level in dfs tree(because in worst case we won't pair only one node at some depth and from first check depth of the tree < (n+1)/2 so we will lose at most n/2 nodes during pairing which is valid).

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Root at any node. Find a dfs Tree.
    If the height is >=N/2 you have a path. Otherwise pair nodes on the same height.

»
7 weeks ago, # |
  Vote: I like it +6 Vote: I do not like it

Nice contest, too bad I wasn't concentrated enough :(

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it
»
7 weeks ago, # |
Rev. 2   Vote: I like it +33 Vote: I do not like it

2 minutes of silence for these people.

»
7 weeks ago, # |
  Vote: I like it +13 Vote: I do not like it
  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I was so close T-T

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

    :( I recognized how to solve it that permutation must have at least one dip but was not able to generalize the series. Thanks for OEIS link.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Pretest 6 For Problem C ????

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

Such a nice D!

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

What's the pretest 3 for problem D

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I liked the problemset.

How to solve D? (I had understood that for n>=4 and m>=4 the answer is -1, but I don't understand what to do next).

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

how to solve C please help??///

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    n!-2^(n-1) is the answer.

    • »
      »
      »
      7 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      why?

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

        number of permutations is n!. And you have to count how many permutation of the form (2,1,3) do you have because that gives you a cycle between 1,2,3. (and 3,1,2 too). The permutations which are not from this type is 1,2,..n (increases) and after n decreases. And that number is 2^(n-1).

        (with 2,1,3 i mean some v[i-1] > v[i] < v[i+1] not just 2,1,3)

        • »
          »
          »
          »
          »
          7 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Didn't the question asked to find the total permutations of length given n? For n=4, is [4, 2, 3, 1] having length cycle of length 4?

          As per the definition given, vi and vi+1 share an edge for all i (1≤i<k), and v1 and vk share an edge. v1 to vk edge is only possible either of 2 cases 1. n-1 at position and n is at last position 2. n is at first position and n-1 is at last position then only we can form a cycle of length n right? Correct me if I am wrong somewhere.

          • »
            »
            »
            »
            »
            »
            7 weeks ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I agree but i can`t see your point. 4,2,3,1 has a cycle of length 3 so i don't care if has a cycle of length 4.

            • »
              »
              »
              »
              »
              »
              »
              7 weeks ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Sorry I misinterpreted the question.

              From the statement, "Given n, find the number of cyclic permutations of length n. Since the number may be very large, output it modulo 109+7.". I thought, we need to find permutations whose cycle length is n.

      • »
        »
        »
        »
        7 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Total permutations = n! Permutations without cycles = 2^(n-1) I'll explain how I got 2^(n-1): For any permutation, if there is no cycle in it then it should follow this logic: 1)For any i,(1<=i<n) numbers i+1,i+2,i+3,... n should lie on the same side, if not then the permutation contains cycle. Then start calculating the ways by following this logic. Eg: for n = 4 You can put 1 in either of the ends.(because all other numbers should be on same side of 1) Then 2 possibilities: 1--- ---1 (you have to fill blankns with 2,3,4) Now, 3&4 should be on same side of 2, so, our possibilities are now 12-- 1--2 2--1 --21 .Recursively this gives 2^n-1 ways.

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

    Use simple permutations and combinations and the principle of inclusion and exclusion :)

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

A very nice contest!! Problem statements were short and to the point.

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

oeis solution of C but I found it at the last minute after my original solution kept failing for large numbers -_-

»
7 weeks ago, # |
  Vote: I like it +11 Vote: I do not like it

People with WA/RTE/TLE on A. Care to explain your soln?
Congrats Beta_R for getting hacked on A twice.

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

how to solve D? I found it really hard to find answer for min(n, m) = 3 because there were too many states

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yeah I also got stuck in that case. Waiting for the editorial!!

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

    there are only 4 states. 1)from {(000), (111)}(consider which of these two require min change) to {(010), (101)} and visa-versa. 2)from {(100), (011)} to {(001), (110)} and visa-versa. check this

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

Has the core idea behind C appeared in a contest in the last year or so? I remember solving a problem which had the same idea (sequence must increase then decrease, find number of ways) not too long ago.

»
7 weeks ago, # |
  Vote: I like it +76 Vote: I do not like it
»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

problem D:

if the matrix is 4 by 4 or greater size answer is -1. and for smaller matrixes, we need to get the answer?

where I went wrong please help me?

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    so far so correct but real question starts after that if you don't want to brute force every case.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

can we solve D without brute-forcing every case separately?

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I think we can XOR the bits (0s and 1s) and come up with a simple approach for dp. I couldn't do it in time though.

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

    if(n>=4) must -1 so we care of n<=3

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

      What should be the states for n==3 ?I couldn't figure it out.

      • »
        »
        »
        »
        7 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        all 1 <= e <=m , arr[0][e] * 4 + arr[1][e] * 2 + arr[2][e] can make the bits. then we can use dp to solve the problem. build the array dp[length][8]

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

    I brute forced for n = 6 and m = 3 and my pc crashed.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Problem D: Am I right in thinking that if the no. of 1s in every 2X2 matrix is odd then no. of 1s in every 4X4 matrix will be even hence answer is -1 for all the matrices with n and m >=4? OR am I missing something. If I'm right, then how to go further?

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    No that's correct, but the hard part is doing the dp for the min(n,m)=2/3 cases

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

Shame on me for not reading the problem properly. I didn't read that only 'R' and 'D' were valid directions for problem B, so I implemented something way more complicated to deal with all 4 directions cardinal directions XD.

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Maybe this will help you fell better but you are not the only one :D

    I started implementing the solution with all directions, after about 10 minutes I saw that there was more than 2K Accepted solutions so I knew something was wrong, read the full statement again and solved it in 2 minutes :(

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

the intresting fact about this contest was that nobody knew the proof for problem C but everyone solved it :))))

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

    I saw that you can have a cycle iff you have a "dip" in the sequence. 95% sure that that's correct, so then I tried to count every permutation without a dip and saw that for every n, it was double the previous one. You're right, no actual proof though!

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

      The permutations that don't work are ascending and then descending. The number of them is the sum of (n-1) choose k from k=0 to n-1, and it's well known that it's equal to 2^(n-1). So the answer is n!-2^(n-1).

      • »
        »
        »
        »
        7 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Interesting. I'll think about it. I was counting it in a more obscure way where I was summing over every possible leftmost element in the permutation so the answer wasn't obvious to me. Thanks!

      • »
        »
        »
        »
        7 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        One way you can see why it's the sum of n-1 choose k from k=0 to n-1 is that you have a 1-1 correspondence between subsets of {1,...,n-1} and a not good permutation because you place all the numbers in your chosen subset to the left of n and then the remaining to the right of n (there is only one way to arrange these two subsets). Or you can just think of it as there being two choices for each number, being on the left of n or the right of n.

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

    i dont think so..

    like when you would see, you will find that when the case is highest number is not at the ends then all such cases will result in cycle and when largest number is at ends there are some cases which will lead to cycle.

    That some cases are the cases from previous number so it's a recurrence relation. tn = (n-2)(n-1)!+2*tn-1

    How it needs proof!

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Non-valid permutations are the one which first increases then decreases, rest all are valid, and number of such permutaions are $$$2 ^ $$$ $$$(n - 1)$$$. So ans is $$$n!$$$ $$$-$$$ $$$2 ^ $$$ $$$(n - 1)$$$

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Problem C was really fun. I saw a pattern and yolod it, and hopefully it passes all the tests LOL.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

proc C, to me, some kind of math proc isn't it?

fact(n) — (fact(n/2)*fact(n/2+n%2)*fact(n-2))

but large number factorial is needed

just my guess....

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    you just have to apply mod anyway so while finding factorial apply mod.

»
7 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Problem C was really awesome and the statements were also quite perfect...

»
7 weeks ago, # |
  Vote: I like it +2 Vote: I do not like it

Isn't the answer to C is fact(n) - 2^(n-1) ???

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Apparently i misread the question for problem C where i was trying to solve for smallest and largest $$$j$$$ on right side of $$$i$$$ ,where as in question it was to consider both sides and by time i realised i misread the question,i had no mood to solve it,but it involved quicksort .

How to solve question $$$C$$$ when edges for $$$i$$$ are considered only from elements of and involving same conditions right side of the array?

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice problemset. I think D can be done by bitmask dp, correct me if I am wrong.

»
7 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it
How to determine if a round is good
»
7 weeks ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

Really nice contest! D was the first dp problem I've done in contest in a while.

Solution for D: If n>=4, the answer is -1. To see this, note that each 4x4 matrix is broken up into 4 2x2 submatrices that are disjoint. If the sum in each of these is odd, then the sum in the 4x4 matrix should be even, which is a contradiction.

Now, we do cases on n=1 to n=3.

For n=1, there are no even sub squares, so the answer is 0.

For n=2, each column alternates between a sum of 1 or 0 mod 2, so theres only two cases to check here (whether the first row has sum 0 mod 2 or 1 mod 2), and that can be done in O(m).

For n=3, you can use dp. Let dp[i][j] be minimum number of moves needed to get the first i columns to satisfy the problem constraints, with the ith row equal to j in binary (so, for example, if j=5, then the ith row would be 101). Then, dp[i][j] = min(dp[i][j],dp[i-1][k]+add), where k ranges from 0 to 8 and is the state of the previous row, and add is the number of moves to change the grid ith row to j in binary (so it would be 2 if the ith row was 000 and j=5 = 101 in binary). Answer is min(dp[m-1][j]) from j=0 to 7, and time complexity is O(m*4^n), but n=3, so it passes. There might be a more efficient solution.

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

Thanks for such a nice contest!

  • Short and concise, formal statements
  • Good problems
  • Good video Editorials
  • Balanced Contest

We want more such contests :)

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

E is a nice problem

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Idk if I'm dumb, was anybody else confused with the "Cycle of length n", for n = 4 there weren't 16 cycle of length 4. Although there were 16 perms. which have cycle.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

My solution for problem C failed on pretest 6 using C++. Later, I changed it to python and it worked. Can someone explain why?

(Did n!-2^(n-1))

C++: https://codeforces.com/contest/1391/submission/89438077 changed to: https://codeforces.com/contest/1391/submission/89443077

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

Nice contest, math lovers for the win. I go back to Div4.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

How to calculate modulo inverse efficiently ?

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

    Calculate $$$n^{mod-2}$$$ (if $$$mod$$$ is prime)

    &