djm03178's blog

By djm03178, 5 years 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 nong 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: gamegamewillwinioi2021

2: oliviahye

3: cnoi

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

| Write comment?
»
5 years ago, # |
  Vote: I like it -6 Vote: I do not like it

Waiting for a good round.

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

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

  • »
    »
    5 years 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).

    • »
      »
      »
      5 years 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.

      • »
        »
        »
        »
        5 years 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.

»
5 years 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!!!!!!

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

BTS bring me here!!

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

I'm your fan

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

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

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

Wow! Korean Round!

»
5 years 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.

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

Man, such a friendly time for us Chinese!

»
5 years ago, # |
  Vote: I like it -20 Vote: I do not like it

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

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

Hope the difficulty distribution is reasonable this time :)

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

I hope the problems are enjoyful.

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

Winner Winner Korean round dinner!

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

BST(Binary Search Tree) bring me here!

»
5 years 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!

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

Too much new problem setter rounds recently.

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

Good tester

  • »
    »
    5 years 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

    • »
      »
      »
      5 years 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.

      • »
        »
        »
        »
        5 years 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!!!!!!

      • »
        »
        »
        »
        5 years 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 :)

      • »
        »
        »
        »
        5 years 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.

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

      So Mike please block jh05013's account!

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

Waiting and still waiting...

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

Good time for Asia programmers!

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

Thank you all ...

»
5 years ago, # |
  Vote: I like it -30 Vote: I do not like it

Is it rated?

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

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

»
5 years 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!

»
5 years ago, # |
  Vote: I like it -23 Vote: I do not like it

I love Korean people.

»
5 years 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!!!

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

Nice time!!!

»
5 years 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!!!!!!!

  • »
    »
    5 years 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.

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

      So what? arsijo's rounds are commonly not welcomed.

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

        So what? your comments are commonly not welcomed.

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

Good Luck for everyone who join this competition.

»
5 years 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!

»
5 years 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.

  • »
    »
    5 years 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.

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

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

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

good job!

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

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

»
5 years 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.

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

Time to go blue

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

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

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

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

»
5 years 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.

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

A good time.

I'd like to become blue this time.

kkkkk

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

hi gamegame do you think you will win ioi 2020

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

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

  • »
    »
    5 years 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.

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

what is the pretest 4 in problem B ?

  • »
    »
    5 years 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

  • »
    »
    5 years 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.

    • »
      »
      »
      5 years 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

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

    I think you should add this to your code QwQ

  • »
    »
    5 years 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.

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

How to solve D?

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

What is the pretest 4 of problem C?

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

WHat was pretest 2 of Problem B?

»
5 years 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.

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

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

Waiting for the editorial guys!

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

Expected time complexity for problem D?

»
5 years 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

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

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

  • »
    »
    5 years 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.

»
5 years 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.

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

How to solve D ?

»
5 years 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?

  • »
    »
    5 years 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.

    • »
      »
      »
      5 years 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

  • »
    »
    5 years 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.

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

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

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

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

    • »
      »
      »
      5 years 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

      • »
        »
        »
        »
        5 years 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

        • »
          »
          »
          »
          »
          5 years 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.

          • »
            »
            »
            »
            »
            »
            5 years 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

          • »
            »
            »
            »
            »
            »
            5 years 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?

»
5 years 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

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

What is the hacking test case for E?

»
5 years 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.

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

»
5 years 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.

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

    firstly you should get whole input, you should not use break when you are coding a multi-test case problem.

»
5 years 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

»
5 years 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.

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

Nice pretest for C :v

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

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

  • »
    »
    5 years 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.

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

.

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

    edited

    • »
      »
      »
      5 years 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

      • »
        »
        »
        »
        5 years 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];

»
5 years 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$$$ ...

  • »
    »
    5 years 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 :)

    • »
      »
      »
      5 years 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

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

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

  • »
    »
    5 years 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);
    
  • »
    »
    5 years 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?

    • »
      »
      »
      5 years 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?

»
5 years 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? .-.

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

When will the rating be updated?

»
5 years 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

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

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

https://codeforces.net/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?

»
5 years 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 =))

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

For Problem E,why hash algorithm fail?

»
5 years 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.net/contest/1200/submission/58612328

  • »
    »
    5 years 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?

»
5 years 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

  • »
    »
    5 years 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.

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

My rating becomes 2019 Nice number LOL

»
5 years 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.

  • »
    »
    5 years 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.

    • »
      »
      »
      5 years 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?

      • »
        »
        »
        »
        5 years 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?

»
5 years 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

  • »
    »
    5 years 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

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

Any ideas to solving F?

»
5 years 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

  • »
    »
    5 years 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.

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

      Check the time of the cases, they're not in the edge of the limit...

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

Someone explain D?

  • »
    »
    5 years 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.

»
5 years 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!

»
5 years 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.

»
5 years 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!