### SPatrik's blog

By SPatrik, history, 2 years ago,

Hello, Codeforces!

I am glad to invite you to take part in Codeforces Round #577 (Div 2), which will be held on Sunday, 4 August at 16:35 UTC.

You will be given 5 problems, one of them will have 2 subtasks and 2 hours to solve them.

The round will be rated for the second division.

Huge thanks to cdkrot and KAN for helping to prepare the round.

I would like to thank to 300iq, isaf27, vintage_Vlad_Makeev, pllk, mohammedehab2002, 74TrAkToR, Rox, _overrated_ for testing the round.

And thanks to MikeMirzayanov for the great codeforces and polygon platforms.

This is my first Codeforces round. Hope you will enjoy it.

Good luck and have fun!

UPD: The scoring distribution is: 500 — 1000 — 1500 — 2000 — (2000 + 1000)

UPD2: Editorial

UPD3: Congratulations to the winners:

Div2:

4: Yazmau

Unofficial Div1:

1: neal

2: uwi

3: scott_wu

• +210

 » 2 years ago, # |   +135 All the " Author's First Codeforces round " are always carefully designed. Can't wait attending this contest.
 » 2 years ago, # |   +41 Wish you the best of luck for organising your first contest
 » 2 years ago, # |   +13 Which question has two subparts? Please share the points of all problems.
•  » » 2 years ago, # ^ |   -18 Does it matter?
•  » » 2 years ago, # ^ |   +27 Usually you know whith the scoring distrbution
•  » » 2 years ago, # ^ |   +155 I told you It doesn't matter XD
 » 2 years ago, # |   0 The time is not friendly for Chinese
•  » » 2 years ago, # ^ |   0 midnight is acceptable for OIer
•  » » 2 years ago, # ^ |   0 Also not friendly for Vietnamese too
 » 2 years ago, # |   +15 I hope it's the first of many.
 » 2 years ago, # |   0 We expect problems would be interesting and this round will be remarkable for PARTICIPANTS & JUDGES.
 » 2 years ago, # |   +3 Which problem has two subtasks?And the what's the markes for each problem?
•  » » 2 years ago, # ^ |   0 qwq. I don't know. Probably is D1 and D2. I guess :)
•  » » » 2 years ago, # ^ |   +11 But it's E1 and E2 XD
 » 2 years ago, # |   0 i have a question... current my email "not visibled" in codeforces, how to fix???
•  » » 2 years ago, # ^ |   +8 It means other users can't see your email.If you want to show it,you can change it in "settings".
•  » » » 2 years ago, # ^ |   +24 thank bae :))
 » 2 years ago, # |   -35 Hopefully, I will become spec.
•  » » 2 years ago, # ^ |   +4 Keep me posted.
•  » » 2 years ago, # ^ | ← Rev. 2 →   +43 why do you want to become spec with your fake account ? try to become pupil with your real account AriaB
•  » » » 2 years ago, # ^ | ← Rev. 5 →   0 previous contest I was newbie and it is not my first contest with this account so I had the same rating as my account. and anyway it's not your business.
•  » » » » 2 years ago, # ^ | ← Rev. 4 →   +13 okay man . it was just a suggestion... i couldn't understand what you wrote but I'm sorry if i upset you.good luck!
•  » » 2 years ago, # ^ | ← Rev. 2 →   +4 Hopefully, You will still pupil and don't become newbie
•  » » » 2 years ago, # ^ |   0 +
 » 2 years ago, # |   +31 Hope C1 and C2 I want rate inflation SpoilerWait, I rarely solve C in live contests :|
•  » » 2 years ago, # ^ | ← Rev. 10 →   -8 Good luck
 » 2 years ago, # |   +41 coding sucks
•  » » 2 years ago, # ^ |   -18 what a stupid comment... how the hell is he getting these upvotes?
•  » » » 2 years ago, # ^ |   0 why are you replying yourself...
•  » » » » 2 years ago, # ^ |   +11
 » 2 years ago, # |   -6 Hope this round goes well.
 » 2 years ago, # | ← Rev. 2 →   -8 As always, I find out everything at the last moment( Good luck to you to!Как всегда, узнаю всё в последний момент( Удачи и Вам!
 » 2 years ago, # | ← Rev. 2 →   0 It's interesting that writing of contest problems is a free creativity. So many authors use imagination and fantasy almost without limits, sometimes even insert jokes.
•  » » 2 years ago, # ^ |   +33 i love good jokeshere is one:what did the microscopic cow say? Спойлерμ
•  » » » 2 years ago, # ^ | ← Rev. 2 →   0 This is anime cowMeow -> nyaMoo -> μ
•  » » » » 2 years ago, # ^ |   0 i really do love farmer john! μ~~~
•  » » » 2 years ago, # ^ |   +1 It's a most funny joke that I see in problemsB. Tavas and SaDDasOnce again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. That's why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas' headphones and told him: "If you solve the following problem, I'll return it to you."
 » 2 years ago, # |   0 This is my first time！ gogogo~！
 » 2 years ago, # |   +4 Guess I'll be master after this round.
•  » » 2 years ago, # ^ |   +4 LOL
•  » » 2 years ago, # ^ |   +6 You can try
 » 2 years ago, # |   +3 There are fewer people take part in this contest.Maybe it is too late,but I'll still enjoy it!
 » 2 years ago, # |   +9 I hope the problem statements are short and clear.
•  » » 2 years ago, # ^ |   0 I exactly agree with you :)
 » 2 years ago, # |   +3 Please don't be stuck, server
 » 2 years ago, # |   -15 When codeforces adds another speedforces.
 » 2 years ago, # | ← Rev. 2 →   0 .
 » 2 years ago, # |   +68
•  » » 2 years ago, # ^ |   0 me too =))
•  » » 2 years ago, # ^ |   +21 And doing it really slow with tons of WA... Rip rating
•  » » 2 years ago, # ^ |   0 relatable
•  » » 2 years ago, # ^ |   0 Maybe you shouldn't post meme which everyone see thousands of times?
•  » » 2 years ago, # ^ |   0 When you wait the end of system tests and the change of rating[Same picture]
•  » » 2 years ago, # ^ |   0 I wish I were you :)
•  » » 2 years ago, # ^ |   +1 SO TRUE!! i did the first three so fast but after that i was just staring at my moniter thinking
 » 2 years ago, # |   +17 D is too hard for D.
•  » » 2 years ago, # ^ |   +19 And E is too hard for E as well
•  » » 2 years ago, # ^ |   +109 D is not too hard. It is too shitty.
•  » » » 2 years ago, # ^ |   0 What is the solution? I feel fucking stupid. :'(
•  » » » » 2 years ago, # ^ |   +6 think it's just some dp on leftmost/rightmost element in each row. lots of typing
•  » » » » 2 years ago, # ^ | ← Rev. 2 →   0 DP. Iterate over rows and for each treasure holding how fast you can reach that treasure with all treasures in the same row be gotten too. That's just my thinking. Late for submiting. RIP rate:)
•  » » » » 2 years ago, # ^ |   0 I think modifiable BFS or something similar.
•  » » » » 2 years ago, # ^ |   +4 $dp_{row, lasty, lastcol}$, where $row$ is the number of row (we need to consider only rows with at last one treasure but in fact it does not matter), $lasty$ is either $0$ or $1$ and means that the last $y$ on the current row we visited is the leftmost $y$ of some treasure on the current row or the rightmost such $y$. And $lastcol$ is either $0$ or $1$ too and means that after visiting the leftmost/rightmost $y$ with the treasyre we go to the left safety column or to the right safety column from this $y$. Transitions are very easy to understand but hard do code.
•  » » » » » 2 years ago, # ^ |   0 Can you elaborate more ? I am not able to understand :(
•  » » » » » » 2 years ago, # ^ |   0 Since you can go only up, never down, you have to collect all treasures of one level at once. This end in standing on the leftmost treasure of one level or the rightmost one.From these two positions there are again four paths to the left/right treasure of the next level.These paths are simple. You can allway either go left, then up, then to the treasure, or go right, then up, then to the treasure.So, you need to write that down in terms of dp recurrence, which is no rocket science, but nasty index fiddling.
•  » » » » » 2 years ago, # ^ |   +13 Said vovuh and get WA)You lost chanse to become a master on this contest((
•  » » » » » » 2 years ago, # ^ |   +3 You can see the bug in diff between WA42 and AC. It is so stupid. Just like me.
•  » » » » » » » 2 years ago, # ^ |   0 In the contest I had more stupid mistake in this problem)But, I fixed it)
•  » » » 2 years ago, # ^ |   +3 Exactly, it is just tons of typing. And E seemed like this as well :(
 » 2 years ago, # | ← Rev. 2 →   +9 TypingForces. Also D is unusually tough.
 » 2 years ago, # |   +24 I can't see B solution meh feels stupid
 » 2 years ago, # |   0 How to solve B?
•  » » 2 years ago, # ^ |   +23 You can always make everything to zero if and only if : Sum of all given numbers is even. No element of array exceeds half of the sum.
•  » » » 2 years ago, # ^ |   +1 Try 3 3 3 5
•  » » » » 2 years ago, # ^ |   0 ???
•  » » » » 2 years ago, # ^ |   +3 I suppose you mean 4 numbers, (3, 3, 3, 5). (1, 4), (1, 4), (2, 4), (2, 4), (3, 4), (1, 3), (2, 3).
•  » » » » » 2 years ago, # ^ |   +3 Or if you meant 3 numbers (3, 3, 5), answer is NO since the sum is odd.
•  » » » » 2 years ago, # ^ |   +3 sum=14 5<=7 3 3 2 4 3 2 2 3 ..... 0 2 2 0 ..... 0 0 0 0
•  » » » » 2 years ago, # ^ |   +3 Use the last element with the first three, then it's 2,2,2,2 and it's easy.
•  » » » 2 years ago, # ^ |   0 Could you explain the second point please?
•  » » » » 2 years ago, # ^ |   +2 Try to think number $x$ as $x$ balls of one color. We can match a ball with another ball with another color (pair with same balls is not allowed). Then, we note that if there are odd balls, we can't complete matching. This is first point. If we have too many balls of one color (by "too many", I mean more than half of all balls), by the pigeonhole principle (although it is pretty straightforward), at least one pair must contain two balls of that color.
•  » » » 2 years ago, # ^ |   0 What about 2 2 2
•  » » » » 2 years ago, # ^ | ← Rev. 3 →   +3 2 2 2 1 1 2 0 1 1 0 0 0
•  » » » 2 years ago, # ^ | ← Rev. 2 →   0 please is there a proof for point 2?
•  » » » » 2 years ago, # ^ |   0 If a color has cardinality over n/2, there is no solution because you will need to pair up two elements of a color at least once. Otherwise, we construct a solution as follows: make each move by choosing of the two largest groups of colors. It is intuitively clear to me that making this kind of move will ensure that, in subsequent moves, no color gets to cardinality over (total number of balls)/2. And if we always preserve this property, there will always be at least 2 piles.
•  » » » » » 2 years ago, # ^ |   +5 ohhhhh, makes sense. Thanks
•  » » » 2 years ago, # ^ |   0 I also thought first one but the second was too away from me :'( how did you find this solution? (I mean the second approach)
•  » » » » 2 years ago, # ^ |   0 It seems quite awkward for me to explain how I approached this problem since I struggled twice (If you take a look at my submission, you'll notice that I tried 2 completely different logic which both were not working). However, I think for this problem some caseworks can help. I basically noticed second approach when I thought of following case :2 numbers, (1, 7). Sum is even, but we can't do the task.
•  » » » » » 2 years ago, # ^ |   0 I also noticed that (1, 7) case but I couldn't bring more :(
•  » » » » » » 2 years ago, # ^ |   +5 Maybe more casework would have been helpful. Restricting to 2 or 3 numbers (which is hand-doable)? Such as (1, 3), (2, 2), (2, 3), ... and thinking with more data.
•  » » » 2 years ago, # ^ |   +8 How do I prove it?
•  » » » » 2 years ago, # ^ | ← Rev. 2 →   0
•  » » » 2 years ago, # ^ |   0 Try 12 3 9 4
•  » » » 2 years ago, # ^ |   0 how do you know that these are all the necessary conditions? How do you know there aren't more? I thought of these in the contest but didn't think it was that simple
•  » » » 2 years ago, # ^ |   0 can you prove it?
•  » » 2 years ago, # ^ |   +7 sum all elements. Than if the sum is odd then return "NO" else check if the largest element is bigger than the sum/2, if it is than "NO" else "YES"
•  » » 2 years ago, # ^ |   +9 Just think nothing!
 » 2 years ago, # |   +3 How to solve D?
•  » » 2 years ago, # ^ |   -9 I think DP or Modifiable BFS possibly.
 » 2 years ago, # |   0 Is N^4 the intended complexity for E1 ?
 » 2 years ago, # |   +6 What is pretest 5 in B ?
•  » » 2 years ago, # ^ |   0 4 1 1 1 3
•  » » » 2 years ago, # ^ |   0 My code is giving YES
•  » » » 2 years ago, # ^ |   0 my code gives yes and logic also say yes but got wrong answer
•  » » 2 years ago, # ^ |   +3 Try 3 2 2 2
•  » » » 2 years ago, # ^ |   0 My code is giving NO
•  » » » » 2 years ago, # ^ |   0 Answer is YES
•  » » » » » 2 years ago, # ^ |   0 NO -_-
•  » » » » » 2 years ago, # ^ |   0 How?
•  » » » » » » 2 years ago, # ^ |   +6 2 1 1 , 1 0 1 , 0 0 0
•  » » » » » » » 2 years ago, # ^ | ← Rev. 2 →   +2 $1<=a[i]<=1e9$
•  » » » » » » » 2 years ago, # ^ |   0 i just think 3 2 2 2 --> 1 0 0 0 -_-
•  » » » » » » » » 2 years ago, # ^ |   +6 sorry. I have entered , but don't know why.
•  » » » » » 2 years ago, # ^ |   0 Ohh.
•  » » 2 years ago, # ^ |   +3 Pretest 5 for problem B is: 5 1000000000 1000000000 1000000000 1000000000 1000000000Answer is YES.
•  » » » 2 years ago, # ^ | ← Rev. 2 →   0 let's make a simplified sample 5 2 2 2 2 2 2 how can this results YES ?!
•  » » » » 2 years ago, # ^ |   0 2 2 2 2 2 2 2 2 1 1 2 2 1 1 0 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0
 » 2 years ago, # |   0 Logic behind B?
•  » » 2 years ago, # ^ |   0 sum(1,n) % 2 =0 and sum(1,n-1) >=a[n] with array a sorted -_- -_- bad at english sorry -_-
•  » » 2 years ago, # ^ | ← Rev. 2 →   0 Think about this test case: 6 6 4. I think you will understand the logic behind solution of B.
•  » » » 2 years ago, # ^ |   0 Got it...Thanks.
•  » » 2 years ago, # ^ |   +11 If the biggest element is not larger than the sum of the rest, then it is possible. If the sum of all elements is even, of course.Basically, if all this holds, then you can take pair "smallest element — largest element" and decrease them until the smallest one becomes 0. Then you just reduced the number of elements, but the two main conditions still hold. You can show by induction that you cannot end up in a situation when you have only one number left -- otherwise the first condition did not hold from the very beginning.
•  » » » 2 years ago, # ^ |   0 wow!
•  » » » 2 years ago, # ^ | ← Rev. 2 →   0 Consider the following array: 4, 17, 19. Sum % 2 == 0 and 19 < 17 + 4. So it should work.If I apply your method of taking smallest — largest pair and decreasing the following happens:First step, take 4 and 19 and reduce and you get 0, 17, 15. Next, take 17 and 15 and you are left with 0, 2, 0. Did I misunderstand anything?
•  » » » » 2 years ago, # ^ |   +5 You don't have to reduce 4 all the way to 0 because when we have 1 17 16 then we will decrease 1 and 17 because they are the biggest and smallest right now. This will retain our claim
•  » » » » » 2 years ago, # ^ |   0 Ah I see, thanks for clearing it up.
•  » » » » » » 2 years ago, # ^ |   0 :)
•  » » » » » 2 years ago, # ^ |   0 So, basically you have to sort the whole array after each turn to make sure the arr[0] and arr[n-1] are getting reduced by 1 where they are smallest and largest pair. Got it. Looks a lot simpler this way.
•  » » 2 years ago, # ^ |   0 I solved without sorting. 'YES' if sum of all elements % 2 == 0 and there's no element which is more than all other values' sum, 'NO' otherwise
•  » » » 2 years ago, # ^ |   0 What in case of 2,4? Will it not be 0 2??
•  » » » » 2 years ago, # ^ |   0 4 > 6/2. Condition does not hold. Should be "NO".
 » 2 years ago, # |   0 any guesses on test case6 of question 3??
 » 2 years ago, # |   0 Test 5 B == killer.
•  » » 2 years ago, # ^ | ← Rev. 2 →   -6 = compilation error on Test 1
 » 2 years ago, # |   0 Anybody know what pretest 7 in D was?
 » 2 years ago, # |   +2 Dafuq was B omfg
 » 2 years ago, # |   0 Logic behind c?
•  » » 2 years ago, # ^ |   0 binary search
•  » » » 2 years ago, # ^ |   0 More precise please
•  » » » » 2 years ago, # ^ |   0 If you want the median to be at least X, you need at least (n / 2) + 1 elements to be greater or equal than X.
•  » » » » » 2 years ago, # ^ |   +5 Nice Approach
•  » » » » 2 years ago, # ^ |   0 Then binary search the value of the median. Let's say the value you want to check is X. Then you have to check, whether you can increase all numbers with indexes from N/2 to N up to X, using only k moves. For this you need: a) prefix sums of array elements, b) to search the first element in the second half of the array which is already larger than X (also binary search).
•  » » » » 2 years ago, # ^ | ← Rev. 2 →   0 You sort the array. Find out the middle element each time. Increment it by 1. But array must remain sorted throughout. Thus, a multiset might help. (I didn't implement it during contest, but I guess the logic is correct. Correct me if I am wrong)
•  » » » » » 2 years ago, # ^ |   0 I tried this solution but WA in pretest6
•  » » » 2 years ago, # ^ |   0 binary search gave me TLE on 2 solution one n*log(n) & the other log(n)² , had to implement the O(n) solution
•  » » » » 2 years ago, # ^ |   0 If you implement binary search correctly, it must be sth like ($n \log n + n \log A$) where $A = 2e9$ and $n = 2e5$. BTW I would really like to learn how $O(n)$ solution works...
•  » » » » » 2 years ago, # ^ |   0 sorry was wrong it's o(n)+n log(n) bcs of the sort at first, the idea is to start from middle and check if you can make all the numbers from middle to current index equal to the next element value on the sorted array, and substract the cost. sol
•  » » » » 2 years ago, # ^ |   +8 Your binary search was TLE because mid was overflowing. int mid = (l+r)/2; l = 10^9 and r = 2*10^9
•  » » » » » 2 years ago, # ^ |   0 I implemented binary search but got WA on pretest 8. can anyone please check? http://codeforces.com/contest/1201/submission/58296147
•  » » » » » 2 years ago, # ^ |   0 but INT_MAX = 2147483647
•  » » » » » » 2 years ago, # ^ |   +8 Sum is coming 3*10^9 which is greater than INT_MAX
 » 2 years ago, # |   +11 A, B, C are standard problems. D is a good problem. For this thank you author.
•  » » 2 years ago, # ^ |   0 Can you explain D ?
•  » » 2 years ago, # ^ |   0 Can anyone please tell me how to solve A? (seriously :)
 » 2 years ago, # |   0 i wanna to ask why my code wrong on pretest 2. https://ideone.com/rwIkPi. they say it is undefined behaviour, but i didn't figure out where it happens.
 » 2 years ago, # | ← Rev. 2 →   0 B reminded me of AGC 036 C.By the way, could somebody hack my solution for D? I solved in a dijkstra-like style. I checked 998244353 times but I couldn't find my bug.
•  » » 2 years ago, # ^ |   +5 My solution is working fine on custom testing on cf for all sample 3 test cases . But failing for 1st test case while submitting. can anyone plss check ithttps://codeforces.com/contest/1201/submission/58300351
•  » » » 2 years ago, # ^ |   0 So what about your mistake? At least, now custom invocation shows "10000000000000000", not the right answer.
•  » » 2 years ago, # ^ |   0 OMG, edit distance was 1...
•  » » » 2 years ago, # ^ |   0 what is the mistake?
•  » » » » 2 years ago, # ^ |   0 СпойлерWhile iterating through the key-value pair of map, I tried to sort each vector on the map. However, I forgot to write "&" in the variable declaration. As a result, each vector was copied into a local variable and that vector was sorted, while the original ones were not. Always be aware that in C++ every assignment is regarded as copy unless you use reference or pointer.Wrong: map> mp; for(auto &p : ts){ vi v = p.second; // vectors are copied into v ... sort(v.begin(), v.end()); // so this won't change original vectors in map! } Right: map> mp; for(auto &p : ts){ vi &v = p.second; // use reference instead. sort(v.begin(), v.end()); } 
 » 2 years ago, # | ← Rev. 2 →   0 When you propose a contest, you is asked to indicate the features of the tasks that are given. To whom what today's tasks seemed unusual and interesting? What is their feature? Who, after solving the problem, got the joy that you came up with a cool solution and it came in? Personally, I did not like any of the ABC. Moreover, I didn’t have joy after the decision of the old C. In addition, D and E, in my opinion, are very difficult for D and E. Sorry from my poor English
 » 2 years ago, # |   0 My solution is working fine on custom testing on cf for all sample 3 test cases . But failing for 1st test case while submitting. can anyone plss check ithttps://codeforces.com/contest/1201/submission/58300351
 » 2 years ago, # |   0 Hey guys, Could anyone please explain to me what is the hack means for contests?
•  » » 2 years ago, # ^ |   0 If your solution's imperfect(even though you passed pretest, it's possible), the others who locked that problem can hack your solution with data which is counterexample.
•  » » » 2 years ago, # ^ |   0 Could you please more clear :D I am new for contests
•  » » » » 2 years ago, # ^ |   0 During the contest, your submissions are only tested on a limited set of test (pretests). It's possible that an incorrect solution can pass pretests, so during the contest, other people in your room who have solved the same problem can choose to lock their problem and "hack" your solution (provide a test case where your soln will fail). Hackers are awarded +100 pts for succesfull hack, -50 for unsuccessful.
•  » » » » » 2 years ago, # ^ |   0 Got it :), Thank you very much.
•  » » » » 2 years ago, # ^ |   +5 The pretest doesn't cover all of test data. So although you passed pretest, it can be a wrong answer. After pretest passed, you can lock the problem. It means you cannot change your answer and you can read other user's code. When you reading code, if someone's code have counterexample, you can enter counterexample and if the hacking attempt's successful, you can get 100point. but if it failed, you lose 50point. Can you understand? (sorry for my poor english)
•  » » » » » 2 years ago, # ^ |   0 Yes finally I understood :), Thanks a lot for your reply
 » 2 years ago, # |   0 Wasn't the contest a bit unbalanced? Still, quite a good contest for a first timer setter. :)
•  » » 2 years ago, # ^ |   0 In any way, I think we have to thank for all efforts :)
 » 2 years ago, # |   +6 Problem D looks similar to a recent task from TCO, except that the one from topcoder restrict the number of safe columns to exactly two.
 » 2 years ago, # | ← Rev. 2 →   0 --deleted--
•  » » 2 years ago, # ^ |   +13 (le + ri) may not fit in signed int.
•  » » » 2 years ago, # ^ |   0 Yup. Thank god towards the end I realised this and got it AC.
•  » » 2 years ago, # ^ |   0 int le = arr[n / 2]; int ri = arr[n / 2] + k + 2, mi; mi = (le + ri) / 2; Someone got overflow...
 » 2 years ago, # |   +21 A nice version of problem D: 1066F - Очередная ходьба в 2D.
 » 2 years ago, # |   +38 Okay, why is E1 worth 2000 and E2 worth 1000? E1 is nothing but dumb coding that doesn't even require much thinking from my perspective, while E2 is a beautiful (in my opinion) and hard problem.Subtasks are getting a bit annoying on CF :(
•  » » 2 years ago, # ^ | ← Rev. 2 →   +30 From perspective of Div2 users both of them are almost unsolvable)P.S. Sorry, not almost:D
•  » » 2 years ago, # ^ | ← Rev. 2 →   +11 "Dumb coding"When even with the unoficials contestants, only 2 persons for 7000 contestants solved it, and that even high rated like scott wu, ecnerwala and a lot others red contestants couldn't solve it, I'm not sure the problem was so "dumb".
•  » » » 2 years ago, # ^ |   +16 Well, they tried to solve E2 instead of E1
•  » » » » 2 years ago, # ^ |   0 Yeah, I didn't consider this
•  » » 2 years ago, # ^ |   +6 Do you see better scoring solution under assumption that subtasks are there?I agree that it sounds questionable when you look at it from this perspective, but it all kinda makes sense. Proper solution gives you E1+E2, for which 3000 is reasonable. During the contest I spent 25-30 minutes thinking on E2 before abandoning it — and the case work that I had at that point was more complicated and messy than the editorial.Yes, E1 is straightforward coding which requires even less thinking than D — but it is, by div2 standard, quite a lot of tedious coding. I don't think it would be fair to say that 58306483 is worth less than solving D. Is it really that wrong to look at it like "either you just code the trivial part and get 2000 for it, or you solve a full problem for 3000"?
 » 2 years ago, # |   +1 Even though I may not have solved most of the problems, I quite enjoyed the contest. The questions were challenging and intriguing at the same time.
 » 2 years ago, # |   +1 Can anyone recommend some problems to solve to develop skills to solve problems like B ?
 » 2 years ago, # |   +3 A, B and C are too easy and D was too tough I think this contest just focuses on speed.
 » 2 years ago, # | ← Rev. 3 →   +22 SPatrik, can you explain to me why did you need this statement that knights are allowed to capture each other? Does it affect anything except solutions that fall as mine because the case was forgotten when I need to capture an opponents knight? And why was not it covered by pretests?
•  » » 2 years ago, # ^ |   0 Without capturing, the problem would be really easy. Just select the knight that can reach it's target faster. With capturing, there is a situation where you have to move more tricky. First go to the opponent target, then to your target. Read the editorial for more details.
•  » » » 2 years ago, # ^ | ← Rev. 3 →   0 Of course, I meant that it would have been greater if knights hadnt been able to move under attack at all, not allowing moving under attack and being immediately captured afterward.
•  » » » » 2 years ago, # ^ |   +8 Yeah, that could be done. That would remove the possibility of those minor error. I didn't think that way. There wouldn't be any other differences, capturing just makes the game more realistic.
•  » » » » » 2 years ago, # ^ |   0 If you like this so, this case should be in pretests at least :). But as I would think in your shoes, the statement that doesnt affect should be removed. Anyway, thanks a lot, I like this problem very much despite that mistake!
 » 2 years ago, # |   +6 Are you kidding? A B C are too easy and D is so hard. it is not suitable as D. For E & F , are you sure you were not make a kidding to us?
•  » » 2 years ago, # ^ |   0 There is no F problem in the contest...
•  » » » 2 years ago, # ^ |   +5 I think he wants to say E1 and E2.
•  » » 2 years ago, # ^ |   0 Isn't standard DP fine for D? E was interesting.
 » 2 years ago, # | ← Rev. 3 →   +27 Thanks to SPatrik for problem C. The same problem was given to the participants of Lipetsk Municipal Olympiad and some participants who wanted to qualify for Sirius (December 2018) about one year ago. So, I had the same problem prepared in Polygon and you helped me realize that my testset wasn't full and some authors' solutions weren't right. Thank you very much :)
 » 2 years ago, # |   +3 for god sake WA on C because of int overflow, Shame ._.
 » 2 years ago, # |   +4 WOW fast system testing
 » 2 years ago, # |   0 Can someone help me find out why is this submission getting MLE? 58305730
•  » » 2 years ago, # ^ |   +5 How deep can your recursion be? If it is too deep, it keeps all variables in the stack.
•  » » » 2 years ago, # ^ |   0 In the worst case the recursion's depth will be equal to the number of states which is N^4 * 2 which is ~ 5 million. Is it really enough to fill up 256 MB?
•  » » » » 2 years ago, # ^ |   0 I do not really know, what exactly each call stores. For sure it is your method variables (passed + 2 internal), it is below 15 B though. But there should be something else, I guess.
 » 2 years ago, # |   0 I dont get why a lot of people failed to solve B.can somebody explain
•  » » 2 years ago, # ^ |   0 Can you explain how you find it to be easy ? Also can you recommend similar problems ?
•  » » » 2 years ago, # ^ |   +5 the theoretical problems about invariance would help
•  » » » » 2 years ago, # ^ |   +3 Thanks, Any source you aware of ?
•  » » » » » 2 years ago, # ^ |   0 i didn't know any english source.but i found THIS LINK for you. and the problems are good.
•  » » » » » » 2 years ago, # ^ |   0 Is there an answer key for that link?
•  » » » » » » » 2 years ago, # ^ |   +1 i didn't find any. you can ask here.
•  » » 2 years ago, # ^ |   0 How to solve it ?
•  » » » 2 years ago, # ^ |   0 the sum of all elements must be even.(because we decrease the whole sum by 2 after each operation)also the biggest element should not be larger than half of the whole sum.(because for every operation that we decrease the biggest element there should be another element bigger than 0 to decrease)
•  » » » » 2 years ago, # ^ |   0 Ok try n = 4, element {12,4,3,9}
•  » » » » » 2 years ago, # ^ | ← Rev. 3 →   0 reduce 12 and 9 till you get3 4 3 0then3 3 2 02 2 2 02 1 1 01 0 1 00 0 0 0
•  » » » » » » 2 years ago, # ^ |   0 Thx
•  » » 2 years ago, # ^ |   0 i forgot that i have to reduce by 1 instead was trying to solve it by reducing full number from other
•  » » 2 years ago, # ^ |   0 They didn't guess that one of elements maybe greater than all another. In this case also there is impossible do it
•  » » 2 years ago, # ^ |   +1 First I thought that you can simply take two biggest numbers, and reduce them as much as possible — and then repeat this procedure until all become 0. But this logic does not always work, for example, for the case 99 100 101.
•  » » » 2 years ago, # ^ |   0 did this soulution pass the pretest?
•  » » » » 2 years ago, # ^ |   0 No. And it took me some time to figure it out.
 » 2 years ago, # |   +4 one should never overthink B otherwise, it cost him his rating
•  » » 2 years ago, # ^ |   +2 True, At the first glance I thought about a partitioning problem and this would have got TLE easily lol
 » 2 years ago, # |   +15 This is my last Div2 Round. But I was late in submitting E1 about 10 seconds so I missed the last chance to win in Div2. QAQ so sad....
•  » » 2 years ago, # ^ | ← Rev. 2 →   +22 I was not sure that my solution is correct and my implementation is correct. So I inserted some assertions in my code. But I accidentally did a wrong assertion. So you can see that I got some REs in my contest submissions. And then I replaced those assertions with exit(0) so I got WA. Then I realized that my assertions was wrong. As soon as I finished to erase them, the contest ended.
•  » » 2 years ago, # ^ |   +12 Maybe it's not your last Div2 round :)
 » 2 years ago, # |   +2 My rating did not update. Why?
•  » » 2 years ago, # ^ |   0 just wait for some moments
•  » » » 2 years ago, # ^ |   +5 Okay. It's my CF Contest. That's why I'm excited. Thanks
•  » » 2 years ago, # ^ |   0 It will be updated a bit later, don't worry :)
•  » » » 2 years ago, # ^ |   +9 Okay. It's my CF Contest. That's why I'm excited. Thanks
 » 2 years ago, # |   0 How this case could be "YES"? Problem B.Test case 5 :51000000000 1000000000 1000000000 1000000000 1000000000Answer YES
•  » » 2 years ago, # ^ |   +1 Just because i dont want do write zeroes, here is explanation for 5 10 10 10 10 109 9 10 10 10 9 9 9 9 10 9 9 9 8 9 9 9 8 8 8 8 8 8 8 8 (and repeat until all are 0)
•  » » 2 years ago, # ^ |   +1 take half of 1000000000 and half of the next 1000000000 ,they cancel out one 1000000000 now we left with: 500000000 500000000 1000000000 1000000000 now it's trivial...
•  » » » 2 years ago, # ^ |   0 Got it thanks.
•  » » 2 years ago, # ^ |   +1 make it 1000000000 1000000000 1000000000 0 0then you can make them1000000000 999999999 999999999 0 0999999999 999999998 999999999 0 0999999998 999999998 999999998 0 0as you can see ,you can reduce all of them by 2 after 3 operation. so you can make all of them zero as well
•  » » 2 years ago, # ^ |   +3 A similar example is {2,2,2,2,2} you can take operations like {1,1,2,2,2} {0,1,1,2,2} {0,1,1,1,1} {0,0,0,1,1} {0,0,0,0,0}
•  » » 2 years ago, # ^ |   0 500000000 500000000 1000000000 1000000000 1000000000 500000000 500000000 500000000 500000000 1000000000 500000000 and 1000000000 give 500000000 so we get : 500000000 500000000 500000000 500000000 now you can conclude the result
 » 2 years ago, # |   -8 can anyone help me finding error in this code `int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //std::setprecision(20); int tests=1; //freopen("input.txt", "r", stdin); // cin>>tests; while(tests--) { ll n,k; cin>>n>>k; ll a[n+1]; for(int i = 1;i<=n;i++) cin>>a[i]; a[0] = 0; sort(a,a+n+1); ll i = (n+1)/2,j; j = i; ll median = a[i]; for(j = i;j a[j]) { if(k >= (a[j+1]-a[i])*(j-i+1)){ k = k-(j-i+1)*(a[j+1]-a[j]); //cout<
 » 2 years ago, # |   0 What wrong with me? It's second consecutive time I passed pretests and got wrong answer in system tests. It's not wrong approach, it is overflow integer. So sad for my rating.
 » 2 years ago, # |   -8 How to solve E? Is it SG function or something else?
 » 2 years ago, # |   0 The code of neal’s problem D has a problem.In its last loop,safe_index might equal to safe.size(),and safe_col has random value.It might lead to “wrong answer”.(Sorry for my poor English)
 » 2 years ago, # | ← Rev. 2 →   +3 Problem D:Could anybody tell me why I always fail on test 13? After reading the editorial,I found that my idea is correct.Maybe some details!code:58360651
•  » » 2 years ago, # ^ | ← Rev. 2 →   0 Check this case: 2 2 1 1 2 1 2 (Ans:3), here the first row does not contain any treasure.
 » 2 years ago, # |   0 In problem div2 C i think like the position of median is not changing right. so sort the array take sum from mid to n add k and divide it with number of element from median position to end that will give the max median . //{sum of(a[position of median to n]+k) divide (n-mid)} but its not working for all case. somebody have any idea