i.e's blog

By i.e, 3 weeks ago, translation, In English

realhype and I are glad to invite you to Codeforces Round #669 (Div. 2), which will take place on Sep/08/2020 17:35 (Moscow time). The round will be rated for all the participants with rating strictly less than 2100.

The problems were created and prepared by realhype and i.e. We would also like to thank everyone who was involved in the round preparation:

You will have 2 hours to solve 5 tasks. One of them is interactive, you should know how to deal with them.

Special thanks to my amazing minipig Schweine, who inspired us during the entire preparation time.

oink

Scoring will be announced shortly before the round.

UPD1: There will be no pictures of minipig in the statements. :)

UPD2: The scoring is 500-1000-1500-2000-2500.

UPD3: EdItOrIaL.

UPD4: Congrats to winners!

Div1 + Div2:

  1. ksun48

  2. WZYYN

  3. I_love_chickpea

  4. neal

  5. jiangly

Div2:

  1. 9623

  2. deep_fake

  3. GiannisAttemptafreethrow

  4. watemus

  5. chad_master_13221

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

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

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

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

As a tester I would say that, the contest is really well prepared and the questions are awesome.

antontrygubO_o orz.

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

Why is LordVoldebug mentioned as a tester twice?

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

    Tested it twice for "high quality testing".

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

    that's different users:)

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

      one user with two different handles or are they actually two users?

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

    LordVoIdebug & LordVoldebug, i think the difference lies in I & l.

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

      Yaa, becoz of lowercase letter L and uppercase letter I looks lies same

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

    Maybe it's a bug. It's in his username after all.

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

i have a night now i scared about picture))))) thanks)

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

My EYES, My EYES !!!

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

Why is Putin2024 a tag?

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

    Because 2024 is a year, when Russia will choose president. Putin is Putin u know

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

No such pics in problem statements plz

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

To be honest, I was scared by the minipig Schweine when I opened the website. Will he be the hero of the problems? I'm looking forward to it(I love interesting background)!

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

what a terrible day to have eyes.

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

istg if you look straight into the eyes of the amazing minipig Schweine you'll have goosebumps.

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

I peed myself looking at that

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

Is this pig the protagonist of the stories in the oncoming round?

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

I hope we don't have a picture of the minipig in every problem statement.

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

My new sleep paralysis demon Boy-scared-of-man-in-door.jpg

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

Opening the site and this minipig is the first thing that comes out to eyes lol. Really looking forward to see him as the theme hero if turns to be so!

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

That picture is terrifying,please no such pictures in problem statements.

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

Can you please put your amazing minipig under the spoiler?

»
3 weeks ago, # |
  Vote: I like it -37 Vote: I do not like it

Why people are being dumb and stupid, and overreacting to the picture??

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

    lesson learnt, i wont post shit again, sorry

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

    laugh is helpful for human,and they trying to make smile in our face. please appreciate them. everybody loves meme.

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

Good ideas of problems you've prepared! Each is worth tasting.

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

A very cute pig =))

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

Get a good night's sleep after look the amazing minipig #_# 1h a.m here

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

Can someone please explain to me why my friend who had rating 1479 before contest got +37 after achieving 3025 rank, and I only got +10 since I had lower rating (1470) than him, and got higher rank than him(2744). This thing is not letting me sleep. Please respond if anyone knows about this ??

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

    Maybe, this post can help you.

    If your friend new on codeforces, then his principle of rate-counting may vary with your for some rounds.

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

    That because the predictor not computes your result right away. 2 minutes per time may be.

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

      I don't understand. Can you please explain?

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

        There is an extension for browsers called cf predictor. It is useful to know your approximate rating change before the actual rating change. NeiH thought that you're talking about its results.

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

          But still I didn't get why I have less rating change then my friend?

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

            I think it is only because it is his 5th contest. Same happened to me and my senior (although on Atcoder). If both of y'all had 15+ contests then i'm pretty sure he'd get a lower delta than you.

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

MikeMirzayanov I think this pic is too much...

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

i.e's comeback after their drop to specialist is my motivation.

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

Can somebody tell me what is an interactive problem?

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

    those problems in which the code interacts with the in real time. When we develop a solution for an Interactive Problem then the input data given to our solution may not be predetermined but is built for that problem specifically. The solution performs a series of exchange of data with the judge and at the end of the conversation the judge decides whether our solution was correct or not.

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

      Oh, Now I get the picture a bit thanks for the info

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

    You may look here............
    This link was in announcement section....

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

I was going to participate in the contest, but now I've seen that pig I'll better lock myself in my bathroom

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

It will be another nice interactive problem :))

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

Thanks for Reference of how to deal with interactive problem

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

    to learn more about interactive problem see the question of long contest in codechef that always have 1 interactive problem.

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

We want to know.

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

Schweine

If you know, you know. :)

»
3 weeks ago, # |
  Vote: I like it -26 Vote: I do not like it

antontrygubO_o Hardworking guy spotted

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

Very magnificent minipig (firstly, i thought it is grey shrek)! I'm looking forward to own resembling one with great pleasure.

»
3 weeks ago, # |
  Vote: I like it -36 Vote: I do not like it

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

scary pig

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

As a minipig, give me contribution

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

the contest is really well prepared and the questions are awesome. :)

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

The pig makes me want to skip the contest...

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

You expect us to solve questions made by so many talented people after seeing that picture. lmao

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

Good luck!

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

![ ](b02acad31d9104ae6c2b82f4478eb7a9741ba34b.jpg)

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

as coautor and creator of deleted offensive meme I want dislikes and harassment charges on twitter

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

"UPD1: There will be no pictures of minipig in the statements. :)"

So sad. I think I'll have to skip the round then.

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

I hope I would become expert in this contest :)!!

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

That pig looks hideous.

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

This picture is so scary!

I was so scared!!

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

MikeMirzayanov This is too much.Please delete this pic.

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

Sorry for off-topic but why hasn't ratings for the last round been rendered back again yet?
PS: Ratings are back now

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

No scary pic in problem statements plz.ToT

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

Why is this picture here??

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

i fear the demons that possess the problemsetters.

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

This pig is causing PTSD.

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

The picture should be removed imo. Maybe it's some kind of meme and maybe it's funny for some people, but I don't get the picture of the pig. I might be overreacting, but it's extremely disturbing to have to see it every time I scroll through codeforces home page. After all, this isn't creepypasta.

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

I was not sure about registering for the contest but after the pig appearing in my dreams for two days straight I am glad to say I'll be losing my score today :/

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

Thanks for putting the pig picture in Spoiler, that's so much better!

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

Oh, thanks for delete the pic.

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

You should have also added, "Resemblance to any living or dead person is purely coincidental." Unless I am mistaken in identifying.

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

If minipig scared you, you should calm yourself with this video:

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

if I manage to get AC in C, it would be very nice :)

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

I hope interactive problem will be nice :) and good luck everyone for the contest.

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

After so many ups and downs i am hoping that my rating increases. :(

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

I made the mistake of clicking on the spoiler 10 mins before the contest. Now, I just have to hope that it won't haunt me during the contest :/

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

Ok this contest is really hard for me! Probably next contest :P

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

First problem is literally laughing at me

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

Is it just me who is feeling the questions to be more difficult than usual?

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

    Maybe because this contest has only 5 problems. So problem A is harder than usual problem A but problem D,E is easier than usual E,F.

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

    I think we all overthinked problem A.

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

When I start practising 1500 rated problems then I'm unable to A,B problems in contests, When I practice A,B level problems then I'm unable to do 1500 or more rated problems. Any solution anyone? :/

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

Unclear question 1407B - Big Vova , I couldn't understand what lexicographically maximal is.

In the clarification, it says "a is a prefix of b, but a≠b" I don't know when a is called a prefix of b. It would be great if Authors could give example to make things clear. Long and unclear question.

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    4 3 1 is lexicographically maximal than 4 2 1..
    If have a way to make c array 4 3 1 then we don't try to make c array > 4 2 1 ..so answer(b array) will be will result which made the c array 4 3 1..
    
  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    $$$a$$$ is a prefix of $$$b$$$ if you can remove 1 or more digits from $$$b$$$ starting from the end and get $$$a$$$

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

Is D DP?

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

    I don't think it can be solved with DP because you can also move backwards.It is a simple BFS the hard part is constructing the graph.

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

      It's given in the question that we can't move backwards

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

        Yeah you are right, I did not catch that so because of that both DP and the Graph approach work I guess.

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

    i solved it using dp and monotonic stack + a BST for transition

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

Even if solution of A is $$$O(n)$$$ why constrain is so low?

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

I love so much when I understand the exact task just 5 min before the end

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

How to do problem C?

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

    Keep the index that corresponds to the highest value among the numbers you looked upto now. Send two queries "? i biggestIdx" and "? biggestIdx i". If the result of first query is smaller than the second, you should update the biggestIdx and before doing that you should update A(biggestIdx) with the result of second query. Otherwise, update A(i) with the result of first query. Finally, you know that A(biggestIdx) is equal to N.

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

      Alternatively, it's possible to start queries from index i=1 and index j=n. If p[i] > p[j], do i+=1 and otherwise do j-=1. Don't have to keep track of the largest index this way.

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

    if a % b > b % a, then a % b equals a, otherwise b % a equals b. it also tells you which one is bigger. any time you ask you save the one you got and compare the next you don't know with the one you are left. so you can do this n — 1 times, the position you are left corresponds to the number n.

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

    if you pick two distinct numbers a and b, and ask a mod b and b mod a,you can find the smaller of the two numbers.keep repeating this until you find n-1 numbers and the final unknown value would be n;

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

      Why only N will be the remaining value?

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

        because you always find the smaller number when you compare both the mods,and N is the largest number in the permutation.

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

          Ohhhh... Nice observation... I got all the idea but was not able to observe that N would be the last remaining number.... Did a O(N) loop to find out :)

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

Similar problem to today's problem E: https://dmoj.ca/problem/ioi11p4

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

Should have not attempted this contest....Bad Day :(

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

Personally this is the hardest contest I ever had.

Can some one tell how to solve A and B after the contest?

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

    For A if the number of zeroes is >=n/2 then just type out n/2 zeroes.Otherwise it means that the number of 1 is greater by at least 2 than the number of zeroes so you write out n/2 ones or n/2+1 ones depending which of those is divisible by 2.

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

    B is just brute force and I have no idea how to solve A.

    In B just take the largest value greedily to make sure the first GCD is largest and mark it as taken. Out of all the non-taken elements choose one that gives the largest GCD, but in order to not recalculate GCD every time, keep the prefix GCD in one variable and update in each iteration.

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

    In A,

    You were supposed to consider as making it all 1's or all 0's because if there are 1's and 0's one of them would dominate the other so the answer would be those max 1's/0's but consider the fact that u cannot take out odd from them so if the max is odd subtract one from them.

    Also u might need to think a little extra for the equality condition in terms of the number you want to output

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

Problem A is very nice for its position. Well done.

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

    If constrain for n were of order $$$10^{5}$$$ then would be more nicer.

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

    i smell the sarcasm here and totally agree

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

      I guess sarcasm is hard to convey in a comment. A is truly one of the better problems I've seen at its position because I had to think for more than 15 seconds to solve it.

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

        SPEECHLESS. You'll become a Master soon. thumbs up bb

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

Smn plz check my solution on B https://codeforces.com/contest/1407/submission/92280369 I don't know why it fails on the second pretest

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

The interactive one was nice...

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

Nice Problems

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

    Always being a tough too solve a interactive problem

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

Problem A killed me, 3 WA and 22 minutes to get it passed. It was my mistake thought :\

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

Someone has hints for D?

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

    There are only $$$O(N)$$$ possible transitions, find them by placing building in increasing/decreasing order then the DP/BFS is trivial.

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

      Shouldn't there be C(n,2) transition while it's only possible to move forward?

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

        No, place the buildings in increasing order and consider the closest building to the left and to the right. It can be proven that every transition will be found by this constructive algorithm. So there are clearly at most $$$4N$$$ transitions.

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

        If you have for example 4 2 2 2 2 4 4 4 4 4 4 4 2 it is faster if you move backwards, you can reach the end in 3 steps.

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

          No, as much as I have understood the problem for an input like 4 4 4 4 the answer must be 3. You can only jump between i & j if and only if the middle elements are strictly greater or smaller.

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

    I kept two stacks where one of them shows the indices of increasing sequence and the other showing decreasing sequence. Then, made binary searches over these stacks and used Segment Tree to get best option among them. However, I got WA at the 5th case and I don't know why...

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

    I used two monotonic stacks to record the indices of increasing sequence and the indices of decreasing sequence, respectively. Iterate height from n-1 to 0.

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

    See this

    For DP in O(N) with increasing — decreasing sequences.

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

problem A is too hard

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

Anyone willing to help my submission for div2 qns C. Did the flush and follow query format but still cant pass. Thanks

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

    I think you messed up with indices when assigning arr[idx1] = smth. That should be arr[idx1-1] right??

    Idk but that's what ig is wrong as I hv the same soln in C++.

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

what the A

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

Hmm.. Now, I'm interested to know how Mr. Kinky Pig inspired this conspira- um.. contest.

Nice problemset btw.

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

Round gave me PTSD.

Took 36 minutes for A, 8 minutes for B. Life's weird.

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

    Suffering from success xD

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

    kinda same with me, 28 mins for A and 11 minutes for B.

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

    Story of this contest:

    • Spent an hour in A, didn't solve with a couple of wrongs.
    • Went to B.. Got a way to solve it in ~10 minutes but WA because of simple small mistake (literally had to change position of variable declaration) but ofcourse I panic-ed and went back to A leaving B for a bit.
    • More 20 minutes on A.
    • Jumped back to B, immediately realized the small mistake and boom AC.
    • Remaining time of contest in A with no luck..
    • Contest ends so I look at submissions of A and realizes I don't need an even sized array as output.......
    • Facepalms and laughs.
»
3 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Has anyone solved D with $$$O(n * log(n) ^ {2})$$$ solution. I got TLE.

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

    Can you tell me your idea. I tried to solve using binary search and segment tree, my solution complexity is also $$$O(n*log(n)^2)$$$ but got not getting correct answer.

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

      Actually I thought like $$$dp[i]$$$ is the minimum steps required to reach $$$ith$$$ index. Now there are cases if $$$h[i] > h[i - 1]$$$, $$$h[i] < h[i - 1]$$$, or $$$h[i] = h[i - 1]$$$.
      $$$ Let$$$ $$$dp[i] = 1 + dp[i - 1]$$$
      if $$$h[i] = h[i - 1]$$$, then do nothing
      $$$if(h[i] > h[i - 1])$$$ then, find the first index $$$i$$$, let's say $$$j$$$ such that $$$h[j] >= h[i]$$$, and also find index $$$k < j$$$, such that $$$h[k] < h[j]$$$.
      $$$if(h[j] == h[i])$$$ then $$$dp[i] = min(dp[i], 1 + dp[j])$$$
      $$$else$$$ $$$dp[i] = min(dp[i], 1 + min(dp[k + 1], dp[k + 2], ..., dp[j]))$$$
      similary handle for $$$h[i] < h[i - 1]$$$.
      I think this is correct but IDK why I got TLE.

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

Is it just me or the implementation for Problem B was very hard?

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

https://www.youtube.com/playlist?list=PLBqHLq3IFiRLBB96TUEoxBvP80s73uSPo

Do visit the editorials of all the problems given .

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

I'm really sad I got C solution idea but couldn't code it in time :(

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

A is cool, but cursed

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

Pupil to Specialist...Great Contest.

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

https://www.youtube.com/channel/UCBStHvqSDEF751f0CWd3-Pg/

Subscribe to this channel for all editorial videos .

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

LOL, What a contest xD

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

Am I the only one who thought problem A required an output of even size... My mistake ofc but just wanna know if I'm the only dumb here lol....

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

Today's div2A problem was the most perfect div2A problem I have ever seen in any CF div2 round.

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

    It would have been better with the test : 8 0 0 0 1 1 1 1 1

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

My rating after me solving A after fourth attempt:

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

    You are not alone, for betterment of my mental health and physical safety of my laptop i headed out of the room after first WA.

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

In today problem C I have submitted O(n) solution in pypy3 it got TLE in tc 6 . Again I have submitted almost same solution and got an AC in 997 ms . I have seen most of the pypy3 codes getting execution time above 900 ms .
But then I have coded it in c++ as it may get TLE again in the systests and got AC in around 300 ms. This is not only today that I have faced this kind of problem , I generally switch to C++ in case of any problem involving recursion . But how may I know that an O(n) can also get TLE .
So to all the respected problem setters please check if the python solution is accepted with a considerable margin or just increase the time limit.

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

    The issue with python is that it never take a fixed amount of time for running a piece of code, running the same code multiple time can sometimes yield different results. This is not just on codeforces but many other platforms also faces criticism for uneven time limits of python but you see its really not in their hands because increasing time limit can make unintended brute force solutions pass the system tests. You can correct me if I'm wrong.

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

      I am not blaming them . I just want to say they should check if the python solution is getting accepted with a considerable margin . If not they can just increase the time limit by some milisecond . 1 to 1.5 or something like that.

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

    They clearly can set TL by language which they dont

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

    Problem with python programmers (who do CP) is they only know how to whine about time limit. First of all, you use not the best tool for a task(python instead of c++/java) then you complain about things not being same for you, like WHAT?

    Also there are many high rated python coders, so clearly things haven't really been unfair, you just don't know python enough for CP. Either learn python more indepth, understand all intricate and subtle things about it then use it for CP (you won't need to complain then) OR use a more appropriate tool(C++/Java/Rust/..)

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

    I agree with you that this interactive had kind of a tight time limit.

    It is possible to pass just using the default PyPy IO 92228274 (951 ms), but the TL is tight. Important to note is that the built in IO in PyPy is far slower than CPython IO. The same code in CPython runs in 655 ms 92292022. The work around for PyPy is to use a drop-in fast IO template 92308464 (670 ms).

    About your code 92261279, there are two ways you could improve it.

    1. Don't import a crap ton of stuff that you don't need/use. Your unused imports at the top take like 150 ms in PyPy3. Also by doing from math import * you are overwriting the very useful built in pow function.

    2. You can make use of fast IO templates like this to greatly speed up the IO in PyPy.

    With both of these improvements your TLE code runs in 748 ms in PyPy 92307825.

    As a final remark, it is possible to get below 300 ms even in PyPy 92288195.

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

Edit: case was wrong nvm

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

    I didn't understand why (4->5) is incorrect. I think the answer will be $$$1$$$ for this test case.

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it +10 Vote: I do not like it
    • max(hi+1,…,hj−1) < min(hi,hj)

    so 4->5 should be feasible

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

In question A div 2 We can not remove consecutive elements so for case 4 1 1 0 0 Why answer's (1 1) and (0 0) are getting passed , Since in both cases consecutive elements are getting removed.

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

This was my first interactive problem which i had tried and got wa only for using long long variable..Is there any restriction about using long long at interactive problem???

Sorry i don't know about that matter.

Thank you kindly for any good response. @realhype

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

    Nope. I use long long everywhere and got AC in C

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

    it is saying that y is out of range because your program is asking x == y and you cant do that "? x y" (1≤x,y≤n,x≠y).

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

      Nope not for that.I was so foolish and i used %d while i was using long long. Later i fixed that and got ac for both int and long long.

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

Who could tell me the correct algorithm to solve Problem.D ? Thanks!

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

What to do if one dosen't get the logic, like me in problem A.?

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

    Skip the problem.Do the others and comeback.Each person can probably solve questions upto slightly above their rating. By that logic I usually try up until D, many a times skipping questions I didn’t get in 10 min.Today is a good example. Didn’t get A in 10 min, so skipped it, did B and C, came back to it, it worked out.

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

In div2C, I got system test failed, submitted in C++17 and now even sample test is not passing for that solution(if it was shown during contest, I could have tried to correct it). While when I submitted the same code after contest in C++11, it got Accepted. Why is this weird behaviour? i.e, realhype

Link for WA(C++17)

Link for AC(C++11)

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

    https://en.cppreference.com/w/cpp/container/set/erase — "References and iterators to the erased elements are invalidated"

    After you do st.erase(a), the memory location that a points to is no longer valid. So cout << (*a) can print non-sense. Get the value before erasing

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

      Ok I got your point, but then why same code in C++11 is giving AC. It should also give WA.

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

        undefined behaviour. Guess you got lucky cuz the old compiler decided not to overwrite the freed memory

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

I don't know good or bad but why was Problem A laughing at me :sob:.

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

Good problems on math.

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

Bye, my rating..Even if we know each other for less than a day, I still miss you from time to time.。

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

Hello everyone,

I received a strange runtime error on TC 10 in today's Problem B — "Big Vova" in pypy2.

Here's the link to simplified code, 92298672

But after adding a useless line to the solution it got accepted. Which was:

if pos == -1:
     print(1/0)

Link to the accepted solution, 92298831

If you read my code, the above snippet never gets executed according to my logic.

I am confused if this is pypy2 fault or cf. There were few other python submissions that had the same problem like this one for example 92244789. If anyone of you knows what's happening please do let me know.

Link to my original submission during the contest 92248591

I would like i.e realhype to see the submissions. Thanks in advance!

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

    What you have there is a bug in PyPy. Me and some friends over on discord have been able recreate the segfaults locally in both PyPy2 and PyPy3, and it has segfaulted on every machine and version of PyPy we've tested it on so far. I've never seen anything like this before.

    Will definitely make a bug report once we find a minimum working example.

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

So,when will move the cheater and change the rating?

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

can i get input and output files for q1 and q2 because i am not able to find my logic anywhere wrong for q1 and in q2 when i checked for wa for input2 it is showing same same as answer and also check my code for q1(https://codeforces.com/contest/1407/submission/92244915) and q2(https://codeforces.com/contest/1407/submission/92258924)

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

    got the mistake for q1 but still not for q2

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

    In B(q2) you are sorting based on best gcd value with only the maximum element this won't work since we need gcd of all elements upto i for each value of ci.

    Instead you need to keep choosing the element that gives best gcd value with gcd(all chosen elements till now). And initially choose only the maximum element.

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

Question D. Discrete Centrifugal Jumps With explanation.

I hope my comments will help others to underastand the solution :)

// vrkorat211 - Vivek Korat

const int N = 3e5 + 5;
 
int n;
int a[N];
void GO()
{
    cin>>n;
    for (int i = 1; i <= n; ++i)
    {
        /* code */cin>>a[i];
    }
    std::vector<int> dp(n+1);
    stack<pair<int,int>> st1,st2;

    st1.push({a[1],1});
    st2.push({a[1],1});

    // dp[i] = minimum step to reach at index i with given two jump properties.
    // pair.second in stacks will store index of pushed element.
    // it will be used to access dp array.

    /**Algo.**/

    // st1 will keep elements with strictly decreasing order.
    // st2 will keep elements with strictly increasing order.

    // for both sequence, if the sequence is broken then pop some elements
    // to get sequence property(strictly increasing or strictly decreasing) back. 

    // when we pop element than one of the jump properties will be followed so update dp[i]
    // accordingly.

    /**\Algo.**/

    // Above comments may help to understand the code :)

    dp[1]=0;

    for (int i = 2; i <= n; ++i)
    {
        //one move always possibee from index (i-1) to index (i) in 1 step;
        dp[i] = dp[i-1] + 1;

        if(a[i] > a[i-1])//st1 property violates.
        {
            //pop untill strictly deacreasing property follows with current element
            while(!st1.empty() && st1.top().first < a[i])
            {
                st1.pop();

                if(!st1.empty())
                {
                    //a[i] and top element follows jump property.
                    //update dp[i]
                    dp[i] = min(dp[i],dp[st1.top().second]+1);
                }
            }
        }
        else if(a[i] < a[i-1]) //st2 property violates.
        {
            //pop untill strictly increasing property follows with current element
            while(!st2.empty() && st2.top().first > a[i])
            {
                st2.pop();
                if(!st2.empty())
                {
                    //a[i] and top element follows jump property.
                    //update dp[i]
                    dp[i]=min(dp[i],dp[st2.top().second]+1);
                }
            }
        }

        // remove top equal elements from both stacks.
        // Because they violates sequence property of both stacks.
        while(!st1.empty() && st1.top().first == a[i])st1.pop();
        while(!st2.empty() && st2.top().first == a[i])st2.pop();

        // Now current element is in proper sequence for both stacks.
        // So push it in both stacks.
        st1.push({a[i],i});
        st2.push({a[i],i});
    }

    //finally d[n] is minimum step to reach at index n.
    cout<<dp[n]<<endl;
}

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

Why I was the last but still give me points?

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

    This is caused by the way new accounts have a "special" calculation of rating. After like 5th contest that effect should be negligible.

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

      ohhhh!I have known 10 minutes ago,thanks a lot.

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

in problem D what is the problem if I get the minimum of going to {current index + 1, the first number bigger than me, the first number lower than me, the biggest number less than me, the lowest number bigger than me} using dynamic programming???? my code

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

Doubt in DIV2 — A

How can we directly remove all the 0's and 1's as it is written in the problem statement that "The elements that you remove don't have to be consecutive." So, if the input array is 0 1 0 1 1 0, then according to the editorial the output must be 0 0 0. So, we have removed two consecutive 1's (i.e. 1 at 4th and 5th position). This is against the problem statement. The correct output for the array 0 1 0 1 1 0 should be 1 1 0 (2nd 4th and 6th position)

Please explain. Thanks in advance :)

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

    I guess it meant the elements we remove don't have to be consecutive ie it's not necessary for them to be consecutive, but they can be.

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

      It is a real english and its meaning is the elements remove cannot be consecutive.

      Otherwise it should be cleared that the element may or may not be consecutive. Please review the problem statement.

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

        What I said was actually what the question meant. That's why they're allowing consecutive elements.Maybe the meaning of the statement is not clear for everyone.

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

92240790 1407A - Ahahahahahahahaha I did pretty much what the question asked for. Coded the brute force approach, but I cant seem to find where I am going wrong ?

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

    What is the idea of that code?

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

      to calculate sum of odd positions and even positions. then checking whether oddSum — evenSum is > 0 or < 0 or == 0. then accordingly removing 1s from either the odd positions or even positions or removing nothing (== 0 case).

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

        If you remove an element, the remaining elements switch group. Previously, all those that are odd indexed after that element become even indexed and vice versa.

        Hence it is easier to just keep all the same digits (either all 1's or all 0's).

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

          oh okay thanks!

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

            There is another simple strategy: We can group the input in groups of 3 elements.

            In such a group there is allways either at least two 1 or two 0. So we output foreach such group "11" or "00".

            The case that length of input==2 must be handled separate.

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

I think problem A was good retrospectively. But only 45% of the participants manage to solve it. If you look at past problems like 651, 652, 654, more than 100% manage to solve problem A (The number are obviously wrong). Yet why such a big variance on problem A results ?

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

thanks for nice contest :)

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

I really enjoyed Problem D, thanks!

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

Such a nice D and E. Wow.