djm03178's blog

By djm03178, 10 days ago, In English,

안녕하세요, 코드포스! (Hello, Codeforces!)

We're glad to introduce you to Codeforces Round #578 (Div. 2), which will start at Aug/11/2019 15:35 (Moscow time). The round is rated for Div. 2 participants.

You will be given 6 problems and 2 hours to solve them. The score distribution will be announced later.

The problems are prepared by hyunuk and me.

Thanks to pllk, Learner99, Rox, mohammedehab2002, cheetose, jh05013, rkm0959, edenooo, and alex9801 for testing the round. We would also like to specially thank to KAN and arsijo for coordinating the round, and of course, MikeMirzayanov for Codeforces and Polygon platform.

This is our very first round, so I hope you enjoy it a lot!

UPD: The scoring distribution is 500 — 1000 — 1250 — 2000 — 2000 — 2500

UPD2: The contest is finished. Thanks for joining us! Here's the editorial.

UPD3: Congratulations to the winners!

Div. 2

1: gamegamewillwinioi2020

2: oliviahye

3: ccf_n0i

4: 2om_neek

5: Tropical_maid

Unofficial Div. 1

1: kcm1700

2: uwi

3: square1001

4: kmjp

5: KrK

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

»
10 days ago, # |
  Vote: I like it -6 Vote: I do not like it

Waiting for a good round.

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

    You are also waiting for some upvotes, aren't you

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

    You definitely should participate, every contest coordinated by arsijo is an ACE (absolutely cool event).

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

      that's true, there are so many Supreme Hilarious Ideal Triumphant contests coordinated by him.

      • »
        »
        »
        »
        10 days ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You’re just another hater. All you can do is to write hateful comments.

»
10 days ago, # |
  Vote: I like it -44 Vote: I do not like it

Why can a user with rating $$$-40$$$ be the tester of a round? That's totally unfair! I don't want to take part in this round!!!!!!

»
10 days ago, # |
  Vote: I like it +35 Vote: I do not like it

BTS bring me here!!

»
10 days ago, # |
  Vote: I like it +36 Vote: I do not like it

I'm your fan

»
10 days ago, # |
  Vote: I like it +35 Vote: I do not like it

It's a friendly contest time for us Chinese :)

»
10 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Wow! Korean Round!

»
10 days ago, # |
  Vote: I like it +50 Vote: I do not like it

Since our hopes were shattered last time, we hope that this time is different.

»
10 days ago, # |
  Vote: I like it +1 Vote: I do not like it

Man, such a friendly time for us Chinese!

»
10 days ago, # |
  Vote: I like it -20 Vote: I do not like it

the success key for this contest is to avoid "string" word.

»
10 days ago, # |
  Vote: I like it +12 Vote: I do not like it

Hope the difficulty distribution is reasonable this time :)

»
10 days ago, # |
  Vote: I like it 0 Vote: I do not like it

I hope the problems are enjoyful.

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

Winner Winner Korean round dinner!

»
10 days ago, # |
  Vote: I like it +18 Vote: I do not like it

BST(Binary Search Tree) bring me here!

»
10 days ago, # |
  Vote: I like it +30 Vote: I do not like it

I want to become purple!I've been waiting for it for a long time!

»
10 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Too much new problem setter rounds recently.

»
10 days ago, # |
  Vote: I like it +89 Vote: I do not like it

Good tester

  • »
    »
    10 days ago, # ^ |
    Rev. 2   Vote: I like it +48 Vote: I do not like it

    It was all done intentionally ; look at his max rating (1700+) . mrk

    some people dream to be 1700+ ,and he wasted all his hardwork just for fun ... really a inspirational guy :-D

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

      It was the opposite, sadly. Participating in short contests turned out to be too stressful for me, so I did this instead. Now I have changed and I don't really care about messing up a contest anymore, so I might start getting an actual rating someday using a different handle.

      I also wanted to see if the rating just goes down forever. It doesn't; at this point my rating goes up even if I don't solve anything.

      • »
        »
        »
        »
        9 days ago, # ^ |
        Rev. 2   Vote: I like it -28 Vote: I do not like it

        So why do you use Codeforces? Almost all contests in Codeforces are short contests!!!!!!

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

        You may have a big jump in some contest like vammadur did before you change your handle. Maybe you can beat him :)

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

        you can still go lower by getting negative score from hacking, though I don't encourage you to do that.

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

      So Mike please block jh05013's account!

    • »
      »
      »
      9 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Seeing your rating graph, I think you might even dream to become pupil again after you participate in 2 or 3 more rounds.

»
10 days ago, # |
  Vote: I like it +8 Vote: I do not like it

Waiting and still waiting...

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

Good time for Asia programmers!

»
10 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Thank you all ...

»
10 days ago, # |
  Vote: I like it -30 Vote: I do not like it

Is it rated?

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

    Seems not...

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

    In the end of the second paragraph,The round is rated for Div. 2 participants.

»
10 days ago, # |
  Vote: I like it +14 Vote: I do not like it

Another Korean Round! I think this round would be wonderful round.

»
10 days ago, # |
  Vote: I like it +2 Vote: I do not like it

I don't need to stay up late for the contest.It's a nice time for Chinese users.Wish everybody(especially me) good luck!

»
9 days ago, # |
  Vote: I like it -23 Vote: I do not like it

I love Korean people.

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

WOW! A very friendly time for Chinese and Korean!!! I won't worry about my sleeping!!!

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice time!!!

»
9 days ago, # |
Rev. 2   Vote: I like it -41 Vote: I do not like it

Why arsijo? I definitely don't want to take part in this contest!!!!!!!

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

    It sounds like a beggar saying "I won't take anything from this fellow". Nobody cares.

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Good Luck for everyone who join this competition.

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

I've been waiting for this round almost one year. so hyped!

»
9 days ago, # |
  Vote: I like it +165 Vote: I do not like it

Wtf, where this dislike of arsijo is coming from? You haven't even seen this round yet, moreover, to my knowledge, most coordination work was done by KAN, and arsijo will just help to arrange the round as KAN may be busy at this time.

Also, by saying this sort of things you express disrespect to authors of the round at the same time. They did so much work, hoping you to enjoy the round, and now you dislike the round even before it began just because of coordinator.

All you guys saying "ohh round by arsijo again" are getting really annoying, not better than dumb "Is it rated" guys.

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

    Why do you expect CF comments to make like any sense? People write random shit coz they are bored or just retarded.

»
9 days ago, # |
  Vote: I like it +5 Vote: I do not like it

Wow!! I hope it would be great round ever!

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

good job!

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

I have the level to solve problem_A/B/C and more but my english level is so poor that I can not understand the meaning of problems QWQ

»
9 days ago, # |
  Vote: I like it +18 Vote: I do not like it

Finally I can take part in a contest without staying out late!

»
9 days ago, # |
  Vote: I like it +13 Vote: I do not like it

Korean-made problems and Korean-friendly contest time. It is perfect if the problems are very wonderful.

»
9 days ago, # |
  Vote: I like it +15 Vote: I do not like it

Time to go blue

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

Desire for becoming Candidate Master within 3 Div.2 Rounds!! :)

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

i think this round #778 very exciting. I hope my rank < 200 ^^

»
9 days ago, # |
  Vote: I like it +17 Vote: I do not like it

I failed to solve problem B in previous 2 contests. I don't want to make a hat-trick.

»
9 days ago, # |
  Vote: I like it +11 Vote: I do not like it

A good time.

I'd like to become blue this time.

kkkkk

»
9 days ago, # |
  Vote: I like it -21 Vote: I do not like it

I don't like problems with long statment :/

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Starting with harder problems is a bad idea because even if you solve them, you won't submit.

  • »
    »
    9 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I can feel you. More than half time passed, still stuck on D. :|

  • »
    »
    9 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    do you mean e because I had the same problem with it that I wasn't able to implement my idea.

    • »
      »
      »
      9 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I was referring to D, because I was scared of entering the contest officially after 45 minutes have passed, and screwing up. I will stick to A->B->c->D->E from now on.

»
9 days ago, # |
  Vote: I like it +23 Vote: I do not like it

hi gamegame do you think you will win ioi 2020

»
9 days ago, # |
  Vote: I like it +14 Vote: I do not like it

5:35 AM ON A SUNDAY MORNING on the US West Coast :(

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

    Thinking the contest was at 7:35 PST, I freaking missed it. Sob with me.

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

what is the pretest 4 in problem B ?

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

    I changed

    if (a[i + 1] >= k)m += a[i] - (a[i + 1] - k);
    

    to

    if (a[i + 1] >= k)m += min(a[i], a[i] - (a[i + 1] - k));
    

    and it passed pretest 4

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

    I had the same problem. I did all I could but couldn't find what was wrong. Ruined the contest for me.

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

      Same for me...First I struggled with pretest 2 but then pretest 4 destroyed me cries

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

    I think you should add this to your code QwQ

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

    you can't dig under 0 so you have to judge it if the next one is less than k.

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

How to solve D?

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

    2D partial sums

    • »
      »
      »
      9 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Further explanation please :D I tried to use segment trees but I can't bring the complexity below $$$O(n^3\log n)$$$

      • »
        »
        »
        »
        9 days ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it
        code
        • »
          »
          »
          »
          »
          9 days ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Yeah... I thought about that but did not code it because I thought it must need to support modification... And then I began happily coding with segment trees for the rest of the contest... Thanks :D

        • »
          »
          »
          »
          »
          8 days ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          can you explain your approach?

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

            Consider a row. It will only be counted in answer if it's completely white, which means at least one subarray of the row of length k must have all the black cells of this row. So, we compute the longest white-only prefix and suffix of the row.

            Next, we find the rectangle of the possible upper left corners of a single k-square such that if the upper left corner of the square lies in this rectangle, the chosen row will become all white. We just update a 2D partial sum matrix, or 2D fenwick tree for this purpose.

            We repeat this for all rows, and then we transpose the matrix, and repeat for all rows again (but be careful that the rectangle is now flipped by 90 degrees). Then we find the max value in the matrix, at matrix[i][j], which corresponds to max rows + colums which can have all it's elements white if a k-square had upper left corner was at cell (i,j).

            However, some rows and columns are completely white in input, which means we can directly count them in our answer and ignore processing these rows and columns completely.

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

    here was incorrect solution :(

»
9 days ago, # |
  Vote: I like it +8 Vote: I do not like it
»
9 days ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

What is the pretest 4 of problem C?

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

How to reach to solution of C ?

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

WHat was pretest 2 of Problem B?

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

I used long double in C, and I am afraid of precision problems now.

»
9 days ago, # |
  Vote: I like it +102 Vote: I do not like it

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

Waiting for the editorial guys!

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Expected time complexity for problem D?

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

Why I keep getting TLE on pretest 11 of problem E?

I think it's O(|s|),Why?

Code

  • »
    »
    9 days ago, # ^ |
      Vote: I like it +3 Vote: I do not like it
    if(P==L){
         ojbk=i;
         OK=1;
    }
    

    This part makes it quadratic. You should use hash for this part

    • »
      »
      »
      9 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Oh my god ,it's only a if

    • »
      »
      »
      9 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      But how to use hash for this part,please explain further,thank you very much

    • »
      »
      »
      9 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I nearly know nothing about hash...

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Can D be solved in O(n*n) time?

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

    Yes, using 2D partial sum to find out how many new white lines are created for each cell being chosen as the top-left position of the eraser.

»
9 days ago, # |
  Vote: I like it -8 Vote: I do not like it

I used divide and conquer and KMP in order to solve problem E . Though I was not quite sure if it would pass TL but my submission got the verdict WA. Can anyone help point out mistake in my solution :

My submission for problem E Apologies for the poorly written KMP.

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve D ?

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

Why wouldnt suffix automaton solution for E pass below the time limit? I couldnt use an array bcs of memory, so i switched to maps, but that gave me tle, but the complexity is O(n*log(alphabet_size)), is the map factor just too big?

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

    Why don't you use String Hash to compare two strings? It can be fast and easy to write.(Though it is slower than KMP)

    And, the alphabet_size=26, I think you should use array to store the edge on the SAM. The factor of map is very big when the size of it is too small like this.

    • »
      »
      »
      9 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      i jump straight to coding instead of thinkingof another solution, thats why i didnt use hash

  • »
    »
    9 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    But the size of it is very big. I think you can think about the Suffix Array to solve the String Problem. When the alphabet_size or the size of string is very big, SAM is very slow.

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

    Oh, I didn't find that the alphabet_size is 62...

  • »
    »
    9 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Is there any way to squeeze suffix automaton in the tl?

    • »
      »
      »
      8 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How are you using SAM? Constructing the terminal states after each new string takes too long and I can't see how to do it without

      • »
        »
        »
        »
        8 days ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        If we assume that we have memory to hold an array for the transitions between states, that means our adding of a transition takes O(1), then our complexity of constructing SAM is O(n), when we query for the largest prefix that is a suffix of the first string, we just traverse the SAM and if we come to the node which is coresponding to the last character inserted into SAM, we found our longest prefix which is a suffix of the first string. By n we denote total sum of lengths of strings in the input, i dont see why this wouldnt pass(only cause of large constant for the map) , correct me if im wrong

        • »
          »
          »
          »
          »
          8 days ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          You can have more nodes corresponding to suffixes in addition to the one corresponding to the entire string. For instance if the string is $$$abb\dots bb$$$ every node corresponding to a substring with only $$$b$$$ is a terminal state.

          • »
            »
            »
            »
            »
            »
            8 days ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Yea, sry, ur right, dont know where did i get that silly idea

          • »
            »
            »
            »
            »
            »
            8 days ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Then, next question, can somehow suffix tree be implemented to fit the tle? To implement a treap for the transitions? Would treap be faster than c++ map? Or is there some c++ built in way to speed up map? And why is map factor so big?

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

Really good contest, in my opinion, even though I wasted a lot of time in A B and C. Almost had enougth time to debug E. RIP Rating twice in a row 1-1

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

What is the hacking test case for E?

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Spent 1 hour trying to read and understand the preprocessing part of KMP. Then figured out that it can be solved with Hashing. Managed to only get A and B after that.

I still don't understand the preprocessing of KMP though.

»
9 days ago, # |
  Vote: I like it +2 Vote: I do not like it

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

Can you please tell me where is a mistake in my solution of B? 58581229

I spent the whole contest trying to find what's wrong with it.

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Hey everyone, do you know what's wrong in my solution for E? 58612747

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

I'm foolish to use (single) unsigned long long for hash.

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice pretest for C :v

»
9 days ago, # |
  Vote: I like it +29 Vote: I do not like it

Hack test case in E for MOD 1e9+7 is nonsense

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

    Dang that sounds really unfair, although I always use weird values to prevent getting owned a little bit more.

»
9 days ago, # |
Rev. 2   Vote: I like it -18 Vote: I do not like it

.

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

    edited

    • »
      »
      »
      8 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Can you help me find my mistake too .

      Link to submission to B

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

        This line:if(arr[i-1]>=arr[i]) c+=min(k,arr[i])+abs(arr[i]-arr[i-1]);

        The conditional is unnecesary, because you can add blocks to the bag while arr[i-1]>arr[i]-k. With that, the sum changes too, the absolute value will generate wrong answer. You should change that line to: c+=min(k,arr[i])+arr[i-1]-arr[i];

        • »
          »
          »
          »
          »
          8 days ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Thank you so much..You are a lifesaver..

»
9 days ago, # |
Rev. 8   Vote: I like it +19 Vote: I do not like it

R.I.P. for my single Hash (use unsigned int) in Problem E

Wrong Answer On Test 65 TAT

Great Hash-Killer!

I will never use single Hash in Codeforces again...

Tips: Using some unusual prime numbers to model can help you pass E

like NTT model number $$$998244353=119\times 2^{23} +1$$$ ...

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

    My single hashing using $$$M = 10^9 + 9$$$ and $$$P = 67$$$ passed here 58620113. Ignore all the calculations in the end in isEqual function I only check the equality of the 3rd hash.

    Edit: uphacked :D. It would be appreciated if people could share in this thread some tips to make string hashing more probable to pass :)

    • »
      »
      »
      8 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      just use random module, smth like 1e9+rand(), and then find the nearest prime

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

Why does Problem D use "cin" get timeout results?

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

    Please add this in your main(),in front of your cin

    ios::sync_with_stdio(false);
    
  • »
    »
    9 days ago, # ^ |
      Vote: I like it +13 Vote: I do not like it

    What an interesting way to trick the plagiarism checker. Isn't it violation of the rules?

    • »
      »
      »
      9 days ago, # ^ |
      Rev. 3   Vote: I like it -6 Vote: I do not like it

      Maybe not.

      This is a well-known skill in China to speed up cin, and cancel the influence from stdio

      As far as I know, lots of chinese OIers use this skills in their own codes.

      For honest, maybe sometimes using cin is more convenient than using scanf, (like Probelm E), and this skill can make iostream faster.

      So why not use this?

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

My submission got TLE on test 3 but it passes the pretests. How is this possible? .-.

»
9 days ago, # |
  Vote: I like it +14 Vote: I do not like it

When will the rating be updated?

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone explain what happens in problem C when both n,m are 1 or any one of them is 1?

»
9 days ago, # |
  Vote: I like it +2 Vote: I do not like it

Please, Can anyone help me know where my solution for problem C fails.?

My Solution

»
9 days ago, # |
  Vote: I like it +22 Vote: I do not like it

https://codeforces.com/contest/1200/submission/58612411

https://codeforces.com/contest/1200/submission/58619785

EXACT SAME CODE PASSES AFTE CONTEST??? I'm that unlucky to just get the wrong base on test 19? Are you kidding me? Can I get this restored?

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

God damn it! I feel so unhappy now (prob.C). I got WA on main test 35 because of real number rounding :(( (look at the selected text parts) In the contest I code like this: During Contest After that I fixed a little bit and got AC :(( After Contest Who has the same errors like this? Show me your hand bruh =))

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

For Problem E,why hash algorithm fail?

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

Please someone tell why my solution for E is failing at case 8. Though the expected and actual output seem to be same.

https://codeforces.com/contest/1200/submission/58612328

  • »
    »
    8 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Basically I had the same idea and my submission failed too. Can someone please help us to understand the error?

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Why my submission failing for no apparent reason?

58615776 Please Help B question

  • »
    »
    9 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    When you do the sum m+= k-abs(h2-h1) you are forgetting that the number of blocks of height h1 could be less than k-abs(h2-h1), so when you do that sum, the remaining number of blocks of that pile become negative, and that's impossible. So, the sum is m+=min(h1, k-abs(h2-h1)), and with that the number of blocks will never be negative.

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

My rating becomes 2019 Nice number LOL

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

58606364 What is wrong with this solution for B ? It fails pretest 4 test case no. 6, but when i run that particular test case on an ide, it shows the correct answer.

  • »
    »
    9 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    If h[i]<h[i+1]<k ,then m-=b makes 'm' increaing ,obviously it's not true.

    • »
      »
      »
      9 days ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Why won't m increase in that case ? Suppose h[i]=4, h[i+1]=6, k=8. Then we can collect all the 4 blocks from h[i] and transfer to m,right?

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

        Sorry it doesn't mean that. Well , k=160,h[i]=47,h[i+1]=107 then u should make b=-47 but not h[i+1]-h[i]-k=107-47-160=-100 ,right?

»
9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

58580810 Could somebody tell me where is my mistake? It's my first time to be hacked in problem A and I'm gona to be crazy. T_T

  • »
    »
    9 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Look into your (**left, right**) variables they took same value in testcases. Two costumers cann't enter same room

»
8 days ago, # |
  Vote: I like it +2 Vote: I do not like it

Any ideas to solving F?

»
8 days ago, # |
Rev. 3   Vote: I like it -67 Vote: I do not like it

As i said in this comment i got TLE on test 3 but it doesn't make sense because the the code passed the pretests.

And the same code after contest got AC.

WTF?

And i lose rating because of this.

Why is this? djm03178 MikeMirzayanov

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

    Because the actual running time can be different every time it's executed. It sometimes happens when your solution is almost at the edge of the time limit.

»
8 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Someone explain D?

  • »
    »
    8 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    consider for each column and for each row, all the available left-top positions of the cfpaint which can make this column or row all white form a rectangle. We define left-bottom position of this rectangle as (x1,y1),right-top position of this rectangle as (x2,y2),and then we need to add 1 to all the position(x,y) which satisfy x>=x1 and x<=x2 and y>=y1 and y<=y2, for this purpose, you can solve it like this: init dp[n+1][n+1] all value as 0,and when you deal with each row or column,first find the available (x1,y1)and (x2,y2),then just do like this: dp[x1][y1]++,dp[x2+1][y1]--,dp[x1][y2+1]--,dp[x2+1][y2+1]++. after solve all the rows and columns, you iterate over dp[n+1][n+1],set dp[i][j]+=dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1],after this find the maximum value in dp is just the answer.

»
8 days ago, # |
  Vote: I like it +16 Vote: I do not like it

경합이 아주 재밌었고 레이팅도 올랐고 덕분에 "아무개"란 단어도 배웠어요! 고마워요ヾ(❀╹◡╹)ノ゙❀

Thanks to this contest I learned a Korean word "amugae" and gained +25 rating points, thank you very much!

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

I have received code coincide message for problem C,Here is the two links:58583425 58592979 I admit that these two codes are very similiar. But it is truly just because the solution for problem C is so simple and the codes between us written similarly accidently.What's more, not only the codes between us looks similiar,many codes are. I have tried to comunicate with Mike, but I didn't get any response yet maybe Mike is very busy now. I just want to show thst I am honest to participate in the contest.

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

For problem F, can someone explain how is the LCM term coming? (Specifically, how is the number of states for a particular vertex 2520 and the logic behind decomposition of the graph in various states).

I'm not sure what the author means by state here.

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

Can anyone explain me why my first submission got TLE and second got AC? I think the both code has same complexity. Thanks in advance. :)

1st submission: https://codeforces.com/contest/1200/submission/58837253 2nd submission: https://codeforces.com/contest/1200/submission/58837269

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

Why problems aren't rated yet?

Edit: They're rated now!