golions's blog

By golions, 3 years ago, In English

Hello Codeforces!

We, the disciples of Omkar (qlf9, Tlatoani, MagentaCobra, golions, and Omkar's newest disciple, rabaiBomkarBittalBang), have written our third contest: Codeforces Round 724 (Div. 2)Omkar 3. It will be held on Jun/06/2021 17:35 (Moscow time) and will be rated for users in Division 2 (rating lower than 2100). As usual participants with rating >= 2100 are allowed to compete too, but the contest will be unrated for them.

You will be given 2 hours to solve 6 problems. There may or may not be an interactive problem, so it would behoove you to read the guide for interactive problems. There also may or may not be competitive programming problems, so you should be sure to thoroughly understand everything here.

We would like to thank:

The scoring distribution is 500 — 1000 — 1500 — 2000 — 2250 — 2500.

May Omkar be with you!

Update: Thank you for participating in our contest! The editorial is here. We have video editorials for every problem there!

Update:

The winners in official standings:

  1. xin_chen

  2. adc-s11-sadge

  3. conqueror_of_rainboy

  4. XOXOX

  5. TwTwTwTwT

The winners in unofficial standings:

  1. neal

  2. Maksim1744

  3. dlalswp25

  4. hank55663

  5. fanache99

Congrats!

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

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

As a tester, Omkar orz!

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

    The best part is that this roughly translates to Om Namah Shivay because Namah literally means to bow. Omkar orz!

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

    Why so much reverence to Omkar? I mean I am just curious. You people aren't even Hindus(ig).

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

Hope you all enjoy our problems :)

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

As a tester, I must say problems are really interesting !! All the Best :)

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

    As a participant, I must say please tell me something new.

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

      Meanwhile Negative delta : I am coming to you tonight

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

        After System Testing, "Virtual Contest and Practice Mode" : You could not live with your own failure. Where did that bring you? Back to me!!!

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

Interesting problems.

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

everyone click the Omkar 3 link

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

I'm still thinking that you all guys know Hindi ?

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

Very quick scoring announcement!

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

Scoring looks pretty balanced, gonna be a nice round!!!

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

When i see there are a lot rounds comming in codeforces :

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

It's time that these posts should use the word "Bugaboo" instead of "problem".

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

I was hoping for becoming Expert but now I might get demoted to pupil :(

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

I like this scoring distribution

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

Wow , another contest this week. If codechef could conduct as many contest as they launch new courses for cp then I would have become 4 star on cc xDD.

»
3 years ago, # |
  Vote: I like it +31 Vote: I do not like it
Problem / Bugaboo Names of this Contest
»
3 years ago, # |
  Vote: I like it -38 Vote: I do not like it

Brother,just curious to know Omkar means what? The link you provided Omkar3 is youtube link that's the hinduism. From my perspective, Here all contestant are not hindu. But you are spreading your religion by Omkar?

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

    You can just replace omkar with god. This is maybe not for spreading any religion, but instead it creates a humour(here). Also the link is a part of that joke, pointing that its their third contest(its like they created a third part of a kids movie)

    At first it baffled me. But later I recognized that it lightened my mood.

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

    .

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

      Lmao yep, my real name is Omkar and I’m American :P

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

Why the organisers are obsessed with Omkar. I don't think they even know Hindi.

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

Hope so I will be able to solve B this time

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

Just curious how to become tester

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

    You should be personally familiar with some problem setter, so (s)he could personally kick the s**t out of you if you leak some problems beforehand, spoiling the contest and efforts of many people )

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

I love CF

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

I don't have much sense of humour, can someone explain what's going on?

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

The good' ol 6 problem 2 hr div2 is back finally!

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

"There also may or may not be competitive programming problems" yeah like why would you include competitive programming problems in a competitive programming contest, that would be very weird.

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

    Yeah they should ask you to create a website :)))

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

Scoring looks encouraging!

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

God for creating the world and the human race.

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

    but when did he disrespected other religion,omkar is name of one of the problem setter and I am sure he said it all in sarcastic way

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

    Ok snowflake

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

after looking at a few comments up here, I would like to imagine a Latin American guy named Jesus creating a round, then they put his name on all problems and thanked him in the announcement blog

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

    He wouldn't say that he created the world and human race, right?

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

      lol Everytime someone has prob with other religion,it is always muslim guy from Indian subcontinent,from santa time to omkar name ( although omkar is name of problem setter and he has surely written that in sarcastic way )and even if he hadn't why did you care so much,I know one muslim writer (Dont remember name) has written " all credits due to allah and allah has created world " thing but then no one felt offended lol and then he say " respect all religions"

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

        Should I reply your comment with a fake id?

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

          who say this id is fake?If it was fake I wouldnt have been active daily for the last 6-7 month,Its just that I prefer upsolving instead of giving contest btw You also know I spit a fact so you brought fake id thing in reply

          LET CF BE CODING COMMUNITY DONT MAKE IT SITE TO START WAR ON RELIGION BASIS OR NATIONALITY BASIS ALL CODERS ARE SAME

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

            Do you know about the new feature of codeforces that if you solve any problem it will be showed in your profile. And your profile says that you didn't solve a problem since April, and you total solved 8 problems since you created this fake account!

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

              Great job exposing your own fake account used for cheating in contests.

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

              Have you even heard of mashup thing,I had done lots of mashup but is this even a point? Point was that you guys had always problem whether it is santa or omkar (although not all muslims, Every community has black spot and I think you are that in Muslims ,cause none of muslims brothers commented except you)

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

      If you want to debate on religion. I'll happy to join you on Twitter. Please let this site be for CP only. It shouldn't matter to anyone if problem setters add one two lines for humour and thanking god according to their own faith.

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

.

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

Omkar orz... Om Namah Shivay!

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

Will Omkar inspire the authors to release the Editorial eventually?

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

there also may or may not be rated contest so you should read all of the rules about unrated contest.

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

ok

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

    you muslims are weird

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

      ok

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

        lol So he was telling me that I uses fake account, Bro when a muslim author said in a contest announcement blog that allah created universe then why didnt u pointed out?

        Again writing same thing LET CF BE CODING COMMUNITY DONT MAKE IT SITE TO START WAR ON RELIGION BASIS OR NATIONALITY BASIS ALL CODERS ARE SAME

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

      Why is this comment getting upvoted?

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

        because it's true..ig??

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

What is the Meaning of Omkar ?

The word OM came from Hindu mythology.

OMKAR ओंकार —

OM + KAR = Om is a indeclinable .It is a sacred syllable and is Uttered as a holy exclamation at the beginning and end of a reading of the Vedas or previous to the commencement of a prayer or sacred work.

KAR is from kri कृ root word , which means doing , making , performing.

It is a term, denoting a sound or word which is not inflected.

OMKAR is a SACRED syllable OM itself.

The exclamation OM. It is a Supreme Brahm.

OMKAR is a powerful word when chanting gives physical and mental health. One can feel certain vibrations in the body and so it controls anger, increases patience and tolerance levels.

Chanting of Omkar improves concentration, brings down stress, anxiety, and tension.

It is a meditation. It reduces negativity.

So the meaning of the name has powerful meanings.

I think this will help you.

Sources: What is the meaning of the name Onkar?, What is Meaning of Omkar

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

    Yes, True that. Only I would like to add-

    . "Om" is considered to be the cosmic sound. It originates back when nothing existed and space was empty & quiet, the creation of universe brought with itself the vibrations of Om. And hence it was the first sound that ever originated.

    . Proper chanting of "OM" has remedial effects on any mental or physical stress because "om" is considered to be made up of every possible frequencies of sound and when chanted, it tunes with the frequencies of self and provides relief.

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

golions, Is there any way to become disciple of Omkar?

»
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

Good Luck everyone!

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

Hail Omkar

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

When a problem score is 2000, does it mean its difficulty is 2000?

I am new to codeforces. Pardon me.

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

    No, it doesn't. The problem score means only the gap between difficulties of the problems. In average it's close to the truth, but now always :)

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

    No. It is the maximum score you can get upon solving the problem. Difficulty is assigned to a problem after the contest is over, on the basis of ratings of participants who were successfully able to solve it.

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

The Marking system feels shit, if you submit first in just 3 min with one error, gives less marks compared to someone who solved it after 25 minutes.

ughhhh

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

    Wrong submissions have penalties. You should consider checking on more test cases before submitting.

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

      Saying by not even sitting in the contest sounds good.

      Here I am the one who failed horribly in the contest and there you are who didn't attend a single contest giving and firing your utopian quotes on me. :)

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

        Sorry if that hurt you. I know how it feels dude. I already solved 3 problems with 5 wrong submissions, I already had negative contributions, so I was just afraid to comment with my actual id because of down votes. hehe, LOL!

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

          Hey bro finally, I submitted 3 with one wrong submission ;)

          when I was chatting with you at that time I was at one :)

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

I personally wouldn't be surprised if someone said: "Anton did NOT reject problems for this contest!"

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

Was Div2 A always this hard?

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

    nah, i consider this problem to be on div2 b/easy c level

    the fact that problem statement is written so bad makes this problem even harder

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

    It wasn't that hard especially if you look at the constraints, which made it quite easy to implement.

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

The problem statements should rather be considered as riddles.

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

i still don't have Diluc and Fischl..ehe..maybe that's why i still fail to solve their problems

»
3 years ago, # |
  Vote: I like it +7 Vote: I do not like it
There also may or may not be competitive programming problems 

Very true, now my tongue has well-defined six-pack abs after going through these tongue twisters.

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

me on A: 31 minutes B: 28 C: 24 I'm not saying it's not balanced but WTF is wrong with me why do I start like an idiot then focus more and more

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

    supahotfire CM perf orz

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

    For me A was harder than B and C. Actually I am not sure if A works. I implemented some brute force for both, A and B, without being able to see if then will TLE or not.

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

      Edit: nvm it was bullshit

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

        if there is one negative number the difference will still be positive since we are taking absolute value

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

          If there's one negative number and a positive one then you will have to infinitely add new numbers

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

            It seems all of our submission where finaly AC. Congrats to your nice delta!

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

              Yup :D Congrats to you too

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

        Nope, why should it fail??

        If the array is [-a, 0]. Then their absolute diff is still positive (|a|). So it will go on forever. Don't give such heart attacks, I solved with the same logic as you lol.

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

          Yeah I just realized it sorry XD

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

Thanks problem B for negative Delta :)

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

First task was pretty hard for div.2 ( Thanks for your time spent for making a contest)

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

participating today was a bad idea

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

I see a huge gap between C and D, but on the other hand there where still a lot of people solving D.

Maybe I missed some more or less obvious observation.

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

    Yeah, you missed a small observation. Let's build array a based on array b from the beginning. So for every operation, we can add at most 2 elements into a. So for the current move, if the previous median is not equal to the new median then there cannot be an element in the array we build (a) whose value is in between the new median and the old median. Because if you add two unknown elements into array [1,2,3,4,5,6,7] then the median can be one of 3,4 and 5.

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

Can someone please help me where I went wrong for bugaboo C? I was getting correct answer on test cases and I am pretty sure about the logic too. 118652416

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

    Not sure how this is supposed to work dp[j] = max(dp[j], j / i);

    The ratio is arr[0][i]/arr[1][i], but not the mathmatical result of the division, but the fraction. So we need to divide both values by gcd(), and then count foreach position how much of them exist left of that position.

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

      If the ratio of D:K upto position j is equal to that upto position i, then I am updating dp[j] to be the number of conntinous groups of size i which is j/i.

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

        The issue is that the continuous groups can have different sizes.

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

          Can you provide a testcase on which my code would fail?

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

            Something like this DKDDKK

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

              It gives 1 1 1 1 1 1. Isnt this correct?

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

                Nope it should be 1 1 1 1 1 2

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

                No, the last one is a 2, since we can split in first two letters, and last 4 letters. Both have ratio 1:1

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

            Hmm, I used ur approach in the beginning and the following testcase did not work: 1 9 DDKDDDDKK

            The answer should be 1 2 1 1 1 1 1 2 2

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

              How is it 2 at the last place? Shouldn't it be only 1 group? Or am I missing something?

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

                DDKDDDDKK can be split into DDK and DDDDKK and both have 2:1 ratio.

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

                  Ohh, my bad. Got your point thanks!

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

Many E's will fail today (at least 2 in my room itself) because they will print $$$-1$$$ instead of $$$10^{9}+6$$$ but I was too lazy to hack lol.

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

    I don't think so, none of the powers of 2 modulo 1e9 + 7 has value equal to 0.

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

Can't believe 3k people solved C

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

    It was easy. Just needed to notice then ratio of D/K remains same as the total. After that its just binary search.

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

      A safer approach than doubles is to store a pair <x, y> representing x / y. However be careful to store it in its reduced form, that is, where gcd(x, y) = 1.

      Also instead of binary search, we can just store the number of times we have encountered this reduced fraction when iterating from left to right.

      Implementation: 118610628

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

    Its a pretty common idea that has appeared a lot (especially at the start of this year on Codechef) — having a map storing some property which becomes the same (or similar) for all valid ranges then checking for each right end. So I don't think its that surprising that a lot of people solved it.

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

      Its a pretty common idea that has appeared a lot
      Can you please give one of those links?

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

        I'm not really good at remembering problem names, but two examples of problems using the right end of a subarray idea, that are somewhat similar to this problem are:

        Mex Subsequence

        Sed Passwords

        There were 2-3 others ones I think (including some at a comparable difficulty to this C that didn't need dp), but I only remember the names of these two problems since I was involved with testing them.

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

    C was easier than B. I think we have to just maintain the simplified ratio of D and K we got till now.

    Like 1:2 is same as 2:4 and which is same as 4:8 so, just divide D and K by gcd for that. As ratio of one part of the string must of equal to the ratio of complete prefix.

    But i feel B more harder than C. Although there was not much difference.

    BTW problem similar to B was also on HackerEarth Link

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

    I don't think that C was 3k easy. Something else is going on.

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

Hello,bro,may i ask how to solve Problem C ? Actually, i don't know the reason why i get wrong answer , :(

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

Out of curiosity, is there a way to solve D by sort of simulating the valid ranges $$$a_i$$$ could lie in using coordinate compression on $$$b_i$$$ plus something like a fenwick tree?

Something like when you initially place a new element we constrain it to lie between (-INF, $$$b_{i} - 1$$$] or [$$$b_{i} + 1$$$, INF), assume they initially lie at the left end and use a fenwick tree to count how many we can move to the right.

I know the intended solution using upper and lower value stacks is easier and more elegant but I'm just curious if such an approach is feasible.

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

    segment tree is very indian

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

    I thought of following approach but could not implement, could someone tell if how to implement if their solution was similar :

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

    Yes, that is more or less what I did. Compress coordinates. Use a binary indexed tree to keep track of values that are fixed. All values from the input need to be fixed, and if values are repeating, it is enough to fix each value once. Values that are not fixed are either minus or plus infinity, and we keep track of the counts. So, iterate over the input array. The first value goes to the Fenwick tree directly.After that, for each value, check how many values so far were strictly larger (including values from BIT and plus infinities), strictly smaller (including values from BIT and minus infinities) and equal to the new intended median. If the value of the median was not fixed before, fix it. The remaining values (1 or 2 depending on whether we had to fix a new value in this iteration) become minus or plus infinity, depending which category is less numerous. After the assignment, check if the supposed median is actually a median.

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

How to solve C ? I tried to iterate on divisors of count of 'D' and then finding the value for possible count for 'K' and then check if the ratio existed somewhere. But I kept wrong answer on Pretest2. my submission. What is the correct procedure to solve this sum ?

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

    Even I tried to do the same but got WA on Pretest 2. :(

    118652416

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

    The key observation is, that if we remove a prefix of given ratio, the remaining part has same ratio.

    So foreach position, we need to find the number of positions left of it with same ratio.

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

    Create a map<pair<int,int>,int> where the key is the ratio, seen as a pair of ints instead of a double. Iterate through the string and keep two counters, current numbers of D (currD) and current numbers of K (currK), for every position in the string call x=gcd(currD,currK) and add one to map[{currD/x,currK/x}] and thats the answer for that position. You are counting how many segments are with the same ratio than your current position.

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

    **if A/B = C/D = E/F then A/B = C/D = E/F = ... = (A+B+E+...)/(C+D+F...) ** Thus a prefix can be divided into Components if The count ratio of D and K in all the partitions is same as that of Prefix . How to Store Fraction in Their Simplest Form : simple form of x/y is X/Y = (x/G)/(y/G) where G=__gcd(x,y) . We Can use map to store the position of Last index where the ratio was {X,Y} if the ratio at any index is i {a,b} the ans[i] = 1 + ans[pos[{a,b}]]; pos is a map.

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

    Move along the array from left to right and for each prefix, find the ratio of D/K (rounded down to simplest form). Maintain a map to count the number of occurrences of this ratio and then the answer for index i is simply mp[ratio] + 1. It is always better to store the ratio as a pair of numerator and denominator to avoid division by 0.

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

    Suppose when iterating from left to right, at index $$$i$$$, we have $$$cnt_D$$$ occurances of $$$D$$$ and $$$cnt_k$$$ occurances of $$$K$$$.

    Now let us note that for a given string, if all the components have the same ratio $$$x:y$$$, then the total string will also have the ratio $$$x:y$$$. So it is sufficient to check for only this ratio.

    Now the answer is just many prefixes till index $$$i$$$ has a ratio $$$x:y$$$ occurred. This works as if for some $$$j \lt i$$$ $$$x_{j}:y_{j}$$$ and $$$x_{i}:y_{i}$$$ have the same ratio, then $$$x_{i}-x_{j}:y_{i}-y_{j}$$$ must have the same ratio. So we can just count this using a map of pairs $$$(x, y)$$$

    However we must also take care of the fact that $$$x:y$$$ and $$$kx:ky$$$ are the same ratio. To do so we can just reduce the ratio to its lowest form by dividing both terms by $$$gcd(numerator, denominator)$$$.

    Code: 118610628

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

Thank you for the contest!

I kinda feel like C and D should be swapped, but then again it's kind of my fault I didn't start reading D after getting stuck on C I guess.

Anyway, it's not really much of a problem, the bugaboos were IMHO still good!

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

Well, Problem E seemed really difficult at first. But the solution is merely two lines!

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

How to solve E ?

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

    I didn't submit since I was too late, but my solution got the samples correct.

    Spoiler

    UPD: Idea got AC post-contest

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

    So, basically, you fix each hash to be 0 or non-zero. Now, which elements in matrix are zero and which are non-zero. Now, suppose you fix the hash at position (i,j) in the matrix to be non-zero, then the value of (i,j) will be the manhattan distance to the nearest zero. My proof is quite tedious but try proving it by contradiction.

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

I just want to know , whether i will have any rating change , if i didn't submit a single line of code, no right no wrong??

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

too many redudant statement, can't understand problem C :(

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

segment tree is very indian

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

My submission to A is totally not legit (TLE), but I managed to pass system tests anyway. Here's my video of the round: https://www.youtube.com/watch?v=dXS6nNiYeZs

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

meet a new cheater This is how Master_Jiraya bypasses Plagiarism testing.

I am watching him from so many contest , He has done this today and in previous contest, and I am sure he must have done it multiple times before as well. People like Master_Jiraya are spoiling the sport. I don't understand where would cheating take them in life. They will never get anywhere in life but always remain what they are i.e cheater. He should be banned from the platform as soon as possible . MikeMirzayanov sir pls ban him and skip his solutions .

todays submission 118639631 118614794 saw his submission time , he is that much pro that he can solved problems in 2 minutes .

kedos++;kedos++;kedos++;kedos++;kedos++;kedos++;kedos++;kedos++;kedos++;kedos++;kedos++;kedos++;kedos++;kedos++; jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++;jai++; jai++;kedos++;jai++;jai--;kedos--;kedos++;kedos++;jai--;jai++;kedos++;jai++;jai--;kedos--;kedos++;kedos++;jai--;

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

How the hell was B approved?! Such an annoying to code problem. The average problem-A on CF requires more thinking than that. I liked C, A today and have almost no clue why my D or E passed. Seemingly dumb guesses that I can't prove.

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

Can anyone give some hints for D?

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

    Whenever you add the two new integers, you have three options.

    1. Add them to the left of the previous median. This results in shifting the median one to left.
    2. Add them to the right of the previous median. This results in shifting the median one to the right.
    3. Add one on either side. Same as previous median.

    Try to think of the situation where the answer would be "NO".

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

How can https://mirror.codeforces.com/contest/1536/submission/118604068 solution pass if the question doesn't say we can remove the element?

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

    Which element is removed? All the required elements are present.

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

    if the given array contains negative elements then the answer is NO, otherwise just print from 0 to 100, it will always contain the given array

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

    if (neg) { std::cout << "NO\n"; }

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

stories (short or big) in problems are good if they can somehow help in imagining. In A,B,C,D if problems were without stories then it would have been good.

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

In C I somehow thought I should split the prefix evenly which waste a lot of time of mine :(

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

Strong Pretests !! :|

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

My opinion about C:

WTF is this explanation ?!! if someone couldn't understand the explanation then he'll see the samples, that's what I did but the sample explain another problem !! I (and I think a lot of peoble) understood it like every segment should have the same number of 'K's and 'D's.

question for the authors: couldn't put a good sample to explain another cases ??!!

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

    Exactly, I also understood the problem to be this, and could not come up with why it is not passing for about 1 hour.. before realizing that the ratio are compared in simplest form.

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

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

Did anyone tried to solve C using sieve? My Attempt — 118650015

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

    See this I used prime factorization 118647756

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

118650415 why TLE? Problem -: B

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

    Use m.find(g)==m.end() instead of $$$m[g]!=1$$$. This is the cause you are getting TLE. In map, [] operator store the key, then check value.

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

EBACDF

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

    Really! was E that easy??

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

      at some moment during solving I just realized that placing zeroes goes to unique table, then submit, then "LOL why it is E?"

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

    E isn't that easy if you don't intend on finding a pattern. But anyways, agreed.

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

    True!!

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

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

Random fact: B can be solved in $$$O(n*|\Sigma|)$$$ using dp on suffix automaton (code). This approach can solve the problem even if $$$n\leq 10^6$$$.

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

My code for B. It is most likely to get MLE in SysTests. Can somebody say, why the memory usage has skyrocketed?

UPD: It passed :'). Still, can somebody tell why the memory usage has skyrocketed? I have used simple brute force.

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

While I'm practicing problems with difficulty 2500, it's very sad that I couldn't solve even C. I didn't have a good observation to solve D either. Not sure what's wrong with me...

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

    you are me+(300-500) cf rating. i am solving so many 2000 problem and still took so much time to solve B, but solved C just by looking at it

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

Problem A and C are hard to implement :)

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

    turns out you can just print from 0 to 100 for A if there isn't a negative element in the array

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

118650415 why TLE? Problem -: B

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

    Although you know that it will run at most n time for any string (worst case: consecutive subsequences) but there's still some additional calculation in the loop so you need to break all the outer loop after you have found the answer.

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

      I just added a break after checking a single character if the ans is present and it gave accepted ... its worst complexity is still O(26*26*26) . How it is possible?

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

        unnecessary loops for each test case are huge when you don't break after you have found an optimal solution.

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

          And if there is a huge test case with answer of 3 characters then? will it no give tle? Btw thanks for helping

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

How to approach slightly modified problem C, if it is asked to find the number of ways to split such that the ratio (D/K) should be the same?

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

    if I understand your question correctly, isn't it just $$$2^{ans - 1}$$$ for each prefix?

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

very nice problems! E was unfortunately very proof-by-AC-able, but the actual induction proof is super clever

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

Dang, I feel like an idiot. When solving A, I didn't realize that the version of Python 3 on the server only supports the 2-argument version of math.gcd(). It took me 17 minutes and 7 wrong submissions to debug this simple error.

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

    One more thing to add here. CF states that it is using CPython version 3.9.1, but if you run

    import sys
    print(sys.version)
    

    you can see that the actual version is 3.8.1. The updated feature to math.gcd you wanted to use was added in Python 3.9. So I'd argue CF is definitely at fault here by mislabeling its version.

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

Idea for E:

Fix which #s turn into 0s.

All other numbers are uniquely determined. Imagine a multisource BFS from every 0. The value of a certain cell is simply its distance to the closest 0.

Answer is 2^X, where X is the number of #s (Edge case if there are no 0s in the original matrix. Then the answer is 2^X-1).

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

    Can you explain to me how is the answer 2^x ? Test case like ##0 when doing 2^x that means at some time the test case will become 110 and it doesn't follow the second constraint of the problem, so how is it 2^x ?

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

      For your input the answer is 4, and 110 doesn't appear: 210, 010, 100, 000

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

I had written correct logic for Problem C during the contest but it was exceeding time limit just because standard print method of Java was not fast enough for the given constraints. Isn't it unfair for non-C++ coders !! The constraint of 2 * 10^5 is carefully chosen to avoid these language specific problems and is widely used. I wonder why it was not considered during the testing phase!! :( golions

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

    We have model solution in Java. In the future I recommend that you use StringJoiner or StringBuilder when outputting a lot of numbers.

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

how can the last output for this test

test

be 2 ? you cannot even divide a string of length 9 in 2 equal chunks .

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

    [KKKDDK] and [DKK] ratio is 1/2

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

    You don't have to equally divide the chunks.

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

      then why is it written this ? Both brothers act with dignity, so they want to split the wood as evenly as possible. as far as i understand english " Even distribution " means equal distribution of something . Thanks to the problem setters you guys have written some beautiful problem statemnts .

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

        It is crearly explained afterwards that ratios should be equal, not exact numbers

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

Problem E is virtually equivalent to 2013 USAJMO Problem 2: https://artofproblemsolving.com/community/c5h532231p3041818

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

To not keep you waiting, the ratings updated preliminarily. We will remove cheaters and update the ratings again soon!

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

I will be green again once cheaters are removed :) . Just 1 point away from being green again .

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

road to purple!!!

first milestone reached, feeling fucking A. Lets go !!!!

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

Isn't "aaa" lexicographically smaller than "ac" according to rule 2 from Problem B. Can anyone explain why this is not correct?

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

    It has more characters

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

    But it's longer than ac, in the problem it needs the shortest one.

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

    Because in statement it is said that: "The MEX of the string is defined as the SHORTEST string that doesn't appear as a contiguous substring in the input." So mex is string of length two, and if there are more than one string of length 2, that sutisfies the condition of mex, than you should pick the lexicographically smallest among those(of length 2).

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

      I guess I was more focused on the lexicographically smallest part and missed the shortest Thank you.

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

    btw if it was based on lexicographically smallest, the answer would always be a prefix of the infinite string: aaaaaa.... lol

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

Can anyone tell what is the best method to generate strings like a,b,c.....z,aa,ab,ab.....az,ba,bb..... and so on in problem B and store in a vector? What is the easiest method? Please share your piece of code.

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

    wasn't able to solve this problem during the contest but after the contest I search for this and luckily found this beautiful way to generate all substring and solve this problem

    string MEX(string s,int n){

    vector<string>substrings;// will store all substring in sorted order
    substrings.push_back("");
    while(true){
        vector<string>temp;// stores all substrings generated in this iteration 
        for(auto c: substrings){// iterating over all subtring 
            for(char i='a';i<='z';i++){
                string str = c;
                str.push_back(i);// adding a,b,c one by one to generate new subtring
                temp.push_back(str);// pushing in temp to use it on next iteration
                if(s.find(str) == string::npos){
                    return str;
                }
            }
    
        }
        substrings.swap(temp);    
    }
    return "";

    }

    Example to understand clearly

    initially, substring contains an empty string we are adding a,b,c...z, one by one to "" and pushing back to temp so temp contains {a,b,c,d.....z} now swap temp and substring Now substring contain {a,b,c,.....z} here the magic happens Now you will extract a (first element) and again add a,b,c...z, one by one so the new substring becomes aa,ab,ac...az you will do the same thing for b,c,d....z so Now temp contains all subtring possible with two char

    Hope you understood it

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

    I use recursion: 118607108

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

Can anyone tell me the rating of each problem and the best time complexity to solve the problem New to CP, was able to solve only 1st problem also what kind of contest should I give as a beginner?

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

Спасибо!

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

Please check these two Submissions for Problem 'C' :-
1.) https://mirror.codeforces.com/contest/1536/submission/118643260
2.) https://mirror.codeforces.com/contest/1536/submission/118699081
Logic is same in both but in 1st submission, I used ratio (in double) as key and in 2nd, I used pair as key of unordered map.
1st one got accepted but 2nd one is giving TLE.
Please Check them ...

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

    Your calculation of hash of pair is poor. Do not combine hashes using simple xor as x ^ y. Use constructions like: x ^ (y + 0x9e3779b9 + (x << 6) + (x >> 2)) or x + y * 1000000007 (in this case you can use some prime number instead of 1000000007).

    And it pass testes: 118753875 and 118754141.

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

This contest's sytle is so strange than others.Almost every problem I had to find the law behind the title ,it's very easy if we find the law ,but if we cann't find the law ,it's very puzzling!...

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

Attention!

Your solution 118628482 for the problem 1536B significantly coincides with solutions Foundnt_Alice/118625677, Believeu_us/118628482. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://mirror.codeforces.com/blog/entry/8790. Such violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked.

I have not cheated at all and two or more person can have same approach for the above problem as it was just about bruteforcing.Neither I have used any public code or ideone.com.You can also check my other codes.Please dont skip the solutions As it is a clear coincidence.MikeMirzayanov Please look into it.

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

Won't the cheaters be eliminated in this round ?