### Livace's blog

By Livace, history, 13 months ago, translation, ,

Hi, Codeforces!

On monday, October 23rd, at 18:35 MSK rated Div. 2 round will be held. Participants from first division can take part out of competition.

The problems for this round were prepared by me. Thanks to Daniil (qoo2p5) Nikolenko, Nikita (neckbosov) Bosov, Alexander (Alladdin) Proskurin, AmirReza (Arpa) PoorAkhavan, Ildar (gainullin.ildar) Gainullin, Alexey (ashmelev) Shmelev for help in preparations and testing problems, Ann Izyumova for help with translation, Nikolay (KAN) Kalinin for the round coordination and Mike (MikeMirzayanov) Mirzayanov for amazing platforms Codeforces and Polygon.

You will have 2 hours for 6 problems.

Hope you will enjoy problems! Good luck!

Upd1: Editorial

Upd2: Congratulation to winners!

### Div2

•
• +187
•

 » 13 months ago, # | ← Rev. 3 →   -47 SpoilerIS IT RATED?
•  » » 13 months ago, # ^ |   -24 Dude, this is Impossible! How?!
•  » » 13 months ago, # ^ |   -44 Before the contest start, always a lot of people want to kown if it is rated, is that inportant?
•  » » » 13 months ago, # ^ |   +7 not iNportant at all xD
 » 13 months ago, # |   -118 Is it rated?
 » 13 months ago, # |   +14 As far as I remember, all the Codeforce Rounds in the past eight months have been rated unless otherwise stated before, during, or after the Contest.
•  » » 13 months ago, # ^ |   -15 "stated before, during, or after the Contest."lmao
•  » » » 13 months ago, # ^ |   +5 During or after the Contest due to sudden troubles during the Contest such as significant error(s) in some problems or temporary server failure.
 » 13 months ago, # |   -8 If people think it is cool to comment "is it Rated ?" in here. You guys are wrong -__-
 » 13 months ago, # |   +1 seriously guys , how two comments with same question and in the same time and they have the same color :/ , the first got upvotes and the other one got downvotes ?
•  » » 13 months ago, # ^ |   -15 A simple plausible explanation is that what is disliked about the second one is not its content, but its repetition, i.e. the second one is a redundant comment.
•  » » 13 months ago, # ^ |   +17 probably the uppercase :-P
•  » » 13 months ago, # ^ |   +11 Fake accounts :p
•  » » 13 months ago, # ^ | ← Rev. 2 →   0 Probably because the all caps comment looks sarcastic.
•  » » 13 months ago, # ^ |   -6 Possible reason may be, The one with more Down votes is 'Grey Coder' and 'Blue' on other side(colour matters).
 » 13 months ago, # |   -26 ** ** *****?
 » 13 months ago, # |   -43 Is it Rated Contest or unrated???
•  » » 13 months ago, # ^ |   -14 It is a rated contest.
•  » » » 13 months ago, # ^ |   -27 thanks bro :)
•  » » » » 13 months ago, # ^ |   -13 Hey Ahsan don't ask that kind of silly question.Div-1,Div-2 codeforces rounds are rated.
 » 13 months ago, # |   +8 To all people who are asking whether the contest is rated: check the tags.
 » 13 months ago, # | ← Rev. 2 →   -29 del
 » 13 months ago, # |   -6 why the registration process for the contest is off.
 » 13 months ago, # |   +110 The increase of the legendary word.
•  » » 13 months ago, # ^ |   +234 This sums codeforces users :)
•  » » » 13 months ago, # ^ |   +2 Sad, but true :-/
•  » » 13 months ago, # ^ |   +92
 » 13 months ago, # | ← Rev. 2 →   -46 how to trigger everyone in 3 words: is it rated?
•  » » 13 months ago, # ^ |   -17 43 dislikes these people are actually autistic haha
 » 13 months ago, # |   -24 Hope problem statements are understandable easily and the contest will enjoyable.
 » 13 months ago, # |   +11 I'm one point below div 1. So to me seems like a notorious coincidence
•  » » 13 months ago, # ^ |   0 I hope you don't lose points in this contest otherwise it won't be a NOTORIOUS coincidence.
•  » » 13 months ago, # ^ | ← Rev. 2 →   +11 Had the same situation few rounds ago, but was 5 points far from div1 :DThe rest of the story isn't really cool xDWish you good luck ^^
•  » » » 13 months ago, # ^ |   0 that was very comforting for him/her i guess. lol XD !!!
•  » » » » 13 months ago, # ^ |   0 Well, he became candidate so I think that was very comforting xDCongratulations ^^
 » 13 months ago, # |   +58 I hope the difficulty of problems decreases gradually. In the last few contests, I have noticed a massive decrease in the number of submissions for the last two problems. The image shows one such contest. Note the actual number of submissions during the contest were quite less than that in the image. The same thing happened in yesterday's cook off on codechef.
•  » » 13 months ago, # ^ |   -17 these things happen only in Div2 . in Div1 the number of solved doesnt differ much
•  » » 13 months ago, # ^ | ← Rev. 2 →   +1 And also, short problem statements.
 » 13 months ago, # |   -25 Oh, God why?
•  » » 13 months ago, # ^ |   +22 I hoped nobody would notice that. I think it's the most stupid mistake somebody made in announcement.
•  » » 13 months ago, # ^ |   -68 Stupid community. Even CIS chat is better.
•  » » » 13 months ago, # ^ |   0 You are yourself part of this community.
•  » » » 11 months ago, # ^ |   0 CIS? What does the acronym stands for? My wildest guess is SpoilerCSAcedemy
 » 13 months ago, # |   +3 Scoring distribution?
•  » » 13 months ago, # ^ |   0 Like always, scores will be disclosed only after start of contest. :(
 » 13 months ago, # |   +48 delayed :P
 » 13 months ago, # |   +27 Delays, classic
 » 13 months ago, # |   -6 Wait for 10 minutes more :(
 » 13 months ago, # |   +22 Looks like they wanted the total registrations to reach 7k :P
•  » » 13 months ago, # ^ |   0 Complete:D
 » 13 months ago, # |   +2 this delay means a lot of inqueue :(
•  » » 13 months ago, # ^ |   +3 No actually it works fast.
 » 13 months ago, # |   +14 Thanks for the delay. I've just noticed that I didn't register for the contest before the delay.
 » 13 months ago, # |   +4 Please, no more delays.
 » 13 months ago, # |   -17 problem B. boring statement with less sample test. annoying.
 » 13 months ago, # |   -7 How to solve Div2 B Nikita And Strings.i didnt' able to solve it plzz help
•  » » 13 months ago, # ^ |   0 my solution is to write two nested loops with the end of the first part and the begin of the third part and maximize your solution and you can calculate the length of the final string with pre-calculations in O(1)
•  » » 13 months ago, # ^ |   0 brute force for 2 points to split the string into 3 parts..
•  » » » 13 months ago, # ^ |   0 That gives TLE? I did same thing and got TLE
•  » » » » 13 months ago, # ^ |   0 yes, it will give TLE if you use any further loop inside 2 nested loops to iterate the string. you can use the 2nd loop to count the frequency of 'a' and 'b' at 2nd and 3rd part of the string. see my code.
•  » » » » » 13 months ago, # ^ |   0 I saw your code after I commented and realized my mistake. Thanks :)
 » 13 months ago, # |   0 Can anyone explain the problem 3? It seem simple but got WA.
•  » » 13 months ago, # ^ |   0 it didnt' seem simple to me
•  » » » 13 months ago, # ^ | ← Rev. 2 →   0 I thought that we simply bomb n to 1, and then bomb 2 place.That would destroy all tanks.But got WACan anyone exaplain why this is wrong?
•  » » » » 13 months ago, # ^ | ← Rev. 3 →   0 For example: if you bomb the 7th, tanks can move to 8, and they'll survive
•  » » » » 13 months ago, # ^ |   0 When you bomb N, and then N-1, some tanks from N-1 might move to N after bombing
•  » » » » » 13 months ago, # ^ |   0 I thought according to the problem, tanks that are not in pos. 1 must move to n-1. So tanks in n-1 must all move to n-2.
•  » » » » » 13 months ago, # ^ | ← Rev. 2 →   0 bt it is given that (a tank in the cell n can only move to the cell n - 1, a tank in the cell 1 can only move to the cell 2)EDIT : oh...that was only for both corners..damn :(
•  » » » » » 13 months ago, # ^ |   0 "a tank in the cell n can only move to the cell n - 1, a tank in the cell 1 can only move to the cell 2"
•  » » 13 months ago, # ^ | ← Rev. 3 →   +5 Problem C explanation : First drop bombs on even numbered cells, then on odd numbered cells, then again on even numbered cells(1-indexing). My solution 31644671
•  » » » 13 months ago, # ^ |   0 we simply bomb n to 1, and then bomb 2 place.That would destroy all tanks. Can u explain why this got WA
•  » » » » 13 months ago, # ^ | ← Rev. 3 →   0 That's what I did too. Don't see why it's WA
•  » » » » » 13 months ago, # ^ |   0
•  » » 13 months ago, # ^ | ← Rev. 2 →   +4 Put bombs first on all even number positions, then odd number positions and finally even number positions. In this way we can make sure every tank is put bombs exactly twice.
•  » » » 13 months ago, # ^ |   0 How did you prove that it is optimal?
•  » » » » 13 months ago, # ^ |   +5 Well, how i solved this question was as follows : I first of all ran a dp solution on my computer for 1<=n<=200( as the dp solution in O(n*n) ), and found out that it is always optimal to pick 2nd number from the start, and therefore I ran a recursive solution. Here is the link to my solution: http://codeforces.com/contest/877/submission/31652910
•  » » » » » 13 months ago, # ^ |   0 Can you share your dp solution?
•  » » » » » » 13 months ago, # ^ | ← Rev. 2 →   +3 https://ideone.com/IUsyIz here is the link to my O(n*n) dp code.
•  » » » » » 13 months ago, # ^ |   0
•  » » » » » » 13 months ago, # ^ |   0 Actually I also coded it in O(n). I was just proving that it is optimal by O(n*n) dp.
•  » » » » 13 months ago, # ^ |   0 Well, you can assume that each tank is in either Even or Odd cell. If its blasted, it goes from Even->Odd or Odd->EvenSo, just had to print minimum of Even->Odd->Even or Odd->Even->Odd, of which for odd n, first is smaller
•  » » » » 13 months ago, # ^ |   +3 Every tank has to be dropped a bomb at least twice. Using this method every tank will be dropped a bomb exactly twice. So no bomb is wasted(i.e. No tank is dropped a bomb more than twice). This has to be optimal.
 » 13 months ago, # |   +1 How to solve B ??
•  » » 13 months ago, # ^ |   0 Iterate for ending position of portion1 and starting position of portion2. Use prefix sum to speed up.
 » 13 months ago, # |   +4 was O(N*M*2*log(n*m)*8) too much for D
•  » » 13 months ago, # ^ |   0 yes
 » 13 months ago, # |   +3 How to solve C ?
•  » » 13 months ago, # ^ |   +6 I had the following logic : - Bomb all even cells. Now all tanks are on odd cells - Bomb all odd cells. All (intial) even cells are destroyed. All odd cells are on even cells - Bomb all even cells.
•  » » » 13 months ago, # ^ |   0 The last logical step is to show that there is no better strategy.
•  » » » » 13 months ago, # ^ |   0 How do you prove that there is no better strategy?
•  » » » » » 13 months ago, # ^ |   0 I don't know. I just know that the lower bound is n (we must hit every cell) and upper bound is n + n / 2. The truth is somewhere in-between :)
 » 13 months ago, # |   0 How to solve D?
•  » » 13 months ago, # ^ |   +3 I did bfs after putting all empty cells in set rowwise and column wise and deleting cells from set after pushing in bfs queue but got TLE on test 6
 » 13 months ago, # |   0 Does this problem have a logN per query solution? :ask for number of occurences of x in range l,rupdate range l,r by some d
 » 13 months ago, # | ← Rev. 3 →   +13 A was clearly the hardest problem, as I didn't really understand the following sentence. :("It is known, that problem is from this contest iff its name contains one of Alex's friends' name exactly once."So I made two submissions, both of which are incorrect but passed pretests. :P
•  » » 13 months ago, # ^ |   0 then what about C,d and E did u solve it
•  » » » 13 months ago, # ^ |   0 Passed pretests on everything.
•  » » » » 13 months ago, # ^ |   -18 you are very intelligent :)
•  » » 13 months ago, # ^ |   0 it didn't clearly i couldn't understand what once his friend or name of friend
•  » » 13 months ago, # ^ |   0 Got hacked on A. For the first time I was actually thankful that I was hacked because it made me realize my code is faulty and reread the question.
 » 13 months ago, # |   0 Why in D grid is 1000 x 1000 (when time limit is 2 sec), it is too big for slower languages. Why not 500 x 500?
•  » » 13 months ago, # ^ |   +8 nmk solutions can pass then
•  » » » 13 months ago, # ^ |   0 If k is big enough then it wouldn't pass 500 x 500? Look there are no solutions with Python nor PyPy, and my Perl solution O(nm) was too slow too :(
 » 13 months ago, # |   +7 E was just a tree version of http://www.spoj.com/problems/LITE/
•  » » 13 months ago, # ^ |   0 Also, 242E - XOR on Segment with ai < 2 instead.
 » 13 months ago, # |   0 Anyone can tell me how they did C? I did a recurrence but I got WA. if its odd then hit the middle one, then recursively destroy (i, mid-1) and (mid+1, j). If even then if mid=floor(n/2) destroy (i,mid) then destroy (mid+1, j) then hit mid. Anyone sees why this is wrong or what the correct answer is?
•  » » 13 months ago, # ^ |   0 I destroyed all even first. Then all odd. Then all even again. Passed Pretests. I dont know about sys tests.
•  » » » 13 months ago, # ^ |   0 May I ask why this is optimal?
•  » » 13 months ago, # ^ |   0 it isn't really a recursive structure since after hitting mid, you leave a guy with 1 health on mid-1 or mid+1, but all the other guys have health 2
•  » » 13 months ago, # ^ |   -13 Hit the even indices Hit the odd indices Hit the even indices Then you'll get a plan with n + n/2 steps
•  » » 13 months ago, # ^ |   +1 I had same mistake. I used almost the same solution.This solution definitely constructive a valid answer, but not in minimum number of bombs needed. I believe it fails when there is a configuration where some element appears once. Just check answer when N = 10.
•  » » » 13 months ago, # ^ |   0 How do you construct a valid answer?
 » 13 months ago, # |   0 Is the intented solution for F O(NsqrtN), and if it is, why are solutions with that complexity getting a TLE?
 » 13 months ago, # | ← Rev. 2 →   +8 hack for A-> DDanilanil :)
•  » » 13 months ago, # ^ |   +5 Some other people forgot to check if the name does not appear more than once in the problem name. Simple hack : AnnAnn but your case is more tricky like AAnnnn since some people removes the first occurrence of the name and then recheck if it is in there one more time.
 » 13 months ago, # |   0 How to solve F?
•  » » 13 months ago, # ^ |   +8 MO
•  » » » 13 months ago, # ^ | ← Rev. 2 →   +5 : I got why my solution didn't work (an implementation bug).I wrote Java solution using Mo (see the submission) and got TLE. I hope this is not the intended solution or the authors will provide a Java implementation for it.
•  » » » » 13 months ago, # ^ |   0 I've also got TLE with Mo on java. I found only one solution on java by uwi (He didn't use maps)
•  » » » » » 13 months ago, # ^ |   +3 He didn't write Mo
•  » » » » 13 months ago, # ^ |   0 You can get rid of the map using preindexing as for each array value v you'll need only three values (v, v — k, v + k)
•  » » » » » 13 months ago, # ^ | ← Rev. 3 →   0 I have just done that and it didn't pass submission
•  » » » » » » 13 months ago, # ^ |   +25 Learn C++ :P
•  » » » » » » » 13 months ago, # ^ |   +4 I can write in C++. I just don't like it :"D. Solving in Java helped me a lot to always look for the optimal solution
 » 13 months ago, # |   0 I do really think it's much easier
 » 13 months ago, # |   +3 Any corner case for Div2 B ?
 » 13 months ago, # |   0 Can't D be done in O(n*m)? I see a lot of solutions with complexity O(n*m*k) passing pretests.
•  » » 13 months ago, # ^ |   0 Carefully observe the 'break' statement and calculate the complexity.
•  » » » 13 months ago, # ^ |   0 No, I noticed pure O(n*m*k) solutions without any break statements passing the pretests.
•  » » » » 13 months ago, # ^ |   +6 I have passed the pretests without any break (see 31647369). However, I got AC after using breaks (31658960), but I do not think I should have gotten AC on a solution of O(nmk).I think that my solution would TLE on a test of the form below. The answer is -1. 1000 1000 1000 ... (..) ... (..) ... (..) ..# ... (..) .#. 1 1 1000 1000 
•  » » » » » 13 months ago, # ^ |   +3 I got TL on such test and I really don't understand why your solution got AC. That's mine — 31650304. It seems to me that they are equal to each other.
•  » » » » » » 13 months ago, # ^ |   0 Your source code has the break (actually return 0) when you pop (x2, y2) from the queue. My source breaks a little earlier, when (x2, y2) is pushed into the queue.
•  » » » » » » » 13 months ago, # ^ |   0 Yeah! Thanks a lot! Actually, I have noticed it a minute ago too. Then, the question why your solution works faster then mine? Difference ~ 500 ms. Because of using vectors? 31661871
 » 13 months ago, # |   0 What should be the output for this in problem A : "DanilDanilOlya"
•  » » 13 months ago, # ^ |   0 NO
•  » » » 13 months ago, # ^ |   0 but the question said, it will be "YES" if ANY ONE OF THE FRIENDS come exactly once.. Little confused, if exactly one of the friends should come exactly once, or any one of them should come exactly once !?!?
•  » » » » 13 months ago, # ^ |   +3 The last sample helps to understand which of them is true, doesn't it?
•  » » » » » 13 months ago, # ^ |   0 In last two of the friends got exactly once..so it should be NO. But what if any one friend came twice but another came once... (found it ambiguous).. < Although System Test Failed on 35 >
 » 13 months ago, # |   +5 How to Solve C ?
 » 13 months ago, # |   0 Any WA test case for this ?http://codeforces.com/contest/877/submission/31642333
•  » » 13 months ago, # ^ |   0 "ba"output: 2
 » 13 months ago, # |   0 Ended up only solving D. A failed at systest because of stupid sizetype being unsigned(so 1-2=2^32-1 which isn't <1), B failed because i stopped searching for more As/Bs after finding B/A, while D was easy BFS(at least for me). I don't understand how did such a small amount of people solve D.
•  » » 13 months ago, # ^ |   0 hi there, can you please tell me why this solution gives MLE? how to get rescue from this?31687090
 » 13 months ago, # |   +7 Codeforces HACK round #442 (Div. 2)
 » 13 months ago, # |   0 If someone would be kind enough to tell me what went wrong with my E submission ( http://codeforces.com/contest/877/submission/31648193 ). Thanks
 » 13 months ago, # | ← Rev. 4 →   0 Is there something wrong with codeforces's servers ???I have submitted the same code 3 times and each time I got run time error even though I didn't change anything in the code.Can someone tell me why 31659189 solution is giving runtime error ?My idea is to turn the tree to an array and then turn this array into sqrt(n) Buckets and then preform the queries on them to get a n * sqrt(n) solution
 » 13 months ago, # |   0 can anybody plz tell me how to solve div2 E.
 » 13 months ago, # |   0 Can anyone explain me why? 31638541
•  » » 13 months ago, # ^ |   +8 n-p[r].size()+1 gets converted to unsigned.
•  » » » 13 months ago, # ^ |   +8 Oh boy :(
 » 13 months ago, # | ← Rev. 2 →   +7 oh boy!I got WA on D test 31I used a simple BFS too and can't find any bugs in my code or algorithmcould sb help me with it :'(
•  » » 13 months ago, # ^ |   0 same here
•  » » » 13 months ago, # ^ |   0 same here 31657307
•  » » 13 months ago, # ^ |   0 You have to maintain visited array for all the 4 sides, mine code also failed due to this but now it passed by maintaining the above information :(
•  » » » 13 months ago, # ^ | ← Rev. 2 →   +5 Do you have any case to prove this?, I haven't been able to come up with a case that makes fail my submission. And test 31 is too large :'(EDIT: I found the case. 7 14 14 XXXXXXXX..XXXX XXXXXXX...XXXX XXXXXX..X.XXXX XXXXX.....XXXX XXXX..X...XXXX XXXXXXXXX.XXXX XXXXXXXXX.XXXX 1 9 7 10 the visit order may be the cause. So you need to memorize the direction too, seen[f][c][d] and that should fix it.
•  » » » » 13 months ago, # ^ |   0 I think test cases are little weak as my this solution passes.
• »
»
»
13 months ago, # ^ |
0

Well, used 4 ifs instead :P

# dirtyProgramming !

 » 13 months ago, # |   -6 Can somebody tell why this code gave WA for case 49 — http://codeforces.com/contest/877/submission/31647784 in problem D?
•  » » 13 months ago, # ^ |   0 Did you find the mistake? My solution failed on the same test case.
•  » » 13 months ago, # ^ |   0 Along with checking dist[i][j] != -1, you also have to check whether dist[i][j] <= dist[curr_i][curr_j] for the breaking condition.Submission with the mentioned changes
 » 13 months ago, # |   0 Suppose if I have a map of size 4 in Div2 C: and I go with the sequence : 2 1 4 3 2 What's wrong with this? Aren't all the tanks damaged after following this sequence? Please Help!
•  » » 13 months ago, # ^ |   0 The tank on 3 can go to 4 so you would need to bomb 4 again.
•  » » » 13 months ago, # ^ |   0 I am sorry, if I am wrong, but we are told that a tank in cell n can only go to n-1 cell, so how would it go to 4, if you could explain this a bit? Thanks!
•  » » » » 13 months ago, # ^ |   +3 It is given in the question that it can go to n+1 or n-1. Only the tank at the border cannot do that.
•  » » 13 months ago, # ^ |   0 forth cell isn't destroyed
•  » » » 13 months ago, # ^ |   0 Fourth*
 » 13 months ago, # |   +3 could somebody plz tell me why this simple bfs code fails on test 31 http://ide.geeksforgeeks.org/5QUsiv Thanks.
•  » » 13 months ago, # ^ | ← Rev. 2 →   0 It failed due to the break part in the 60th line. Supose you are in position xi, yi and you are going downwards. Now you are checking (xi+i,y) but this was already visited. Just because you have previously visited (xi+i,y) you cannot assume that the next cell (xi+i+1,y) (or any of the next reachable cells) is also visited, hence the break is incorrect. And without the break you get TLE.
•  » » » 13 months ago, # ^ | ← Rev. 3 →   0 ok ok. got it. so what i think is if a cell is already visited, better not push it, instead of breaking at the point
•  » » » » 13 months ago, # ^ |   0 Also, Olya can walk UP to k units, and does not necessarily have to walk k units/hits the end of the room/hits an obstacle.
 » 13 months ago, # | ← Rev. 2 →   +27 Livace do you hate me? I'm in top 5 div1 :(
•  » » 13 months ago, # ^ |   0 Oh, sorry. I'll fix it.
•  » » 12 months ago, # ^ |   0 you are nothing.... min_25 is best in world after that tourist then peter then W4yneb0t and then moejy0viiiiiv ... you are just a crazy boy ;)
 » 13 months ago, # | ← Rev. 2 →   0 I solved B by the DP method. I tried to find the largest "increasing" subsequence. Wrong answer 15. Can anybody prove why my decision is wrong? My solve: 31644137
•  » » 13 months ago, # ^ |   +1 Your code fails for abaabba output should be 6
•  » » » 13 months ago, # ^ |   0 I already away back understood what the error is, but thanks anyway! Stupid mistake! :(
 » 13 months ago, # | ← Rev. 6 →   +11 The problems were cool, but the pretests were really annoying since they actually didn't contain anything important (like tests 48 & 49 for D). Only 2 D's from my room passed system testing. Out of 14!
•  » » 13 months ago, # ^ |   0 Hey! What were those cases ? My solution is failing on Case 30.
•  » » » 13 months ago, # ^ |   0 So have you solved the problem? I am always failing on the test 31. What a pity...
 » 13 months ago, # |   0 In the Problem statement for C it was given that If we drop a bomb on the tank in nth cell then the tank will be half damaged and will move to (n-1)th cell.So if we start dropping bombs from nth cell and and go on until first and then in the very last we drop bomb on 2nd then it gives answer (n+1).for example say we have n=3. So at first we have a configuration 1 2 3. After dropping the first bomb on third cell--> 1 23 _ (3rd tank moved to 2nd cell and half damaged) After dropping the 2nd bomb on 2nd cell --> 12 _ _ (3rd tank is completely destroyed and 2nd is half damaged and moved 1st cell) After dropping the 3rd bomb on 1st cell --> _ 1 _ (2nd tank is completely destroyed and 1st tank is moved to 2nd cell)This is true for any number of cell.Have I misunderstood something? I can't also see that problem now as the problem page is showing a error saying "Oops! Something broke on Codeforces. Do not panic. You can try to reload the page or go back to the main page . We already read the megabytes of logs, solving the problem."
•  » » 13 months ago, # ^ | ← Rev. 2 →   0 Tank at nth position can move either to the left or right, but only tanks at the border can move to cell N — 1, in case of position N (last) or 2 in case of postion 1
 » 13 months ago, # |   +5 After I saw that contest will be only 2 hours long, when 6 problems, I thought maybe contest should be longer. Now I think that contest surely should be longer! Because three problems A, B, D are really tricky so interesting to hack.
 » 13 months ago, # |   +3 I feel like I've seen problem E before...
•  » » 13 months ago, # ^ |   0 Now I understood, similar to Light Switching with a dfs order.
 » 13 months ago, # |   0 I have a question about div2 D.Here is the statement of concern: Problem Statement"Olya drank a lot of energy drink, so now she can run k meters per second. Each second she chooses one of the four directions (up, down, left or right) and runs from 1 to k meters in this direction. Of course, she can only run through empty cells."Does this mean she can run UP to k or she has to run k unless she hits the edge/an obstacle? I assumed it meant she ran k, but my solution — 31656460 failed test case 5.
•  » » 13 months ago, # ^ |   0 up to k,you can only run 1
•  » » » 13 months ago, # ^ |   0 I changed it to up to K but it times out :/ 31690018
 » 13 months ago, # | ← Rev. 2 →   0 How should i understand div2 B correctly my friends? I thought a beautiful string is a string that can be cut into exactly 3 substrings described as in the problem. What did i do wrong? I can't even understand english nowadays!
•  » » 13 months ago, # ^ |   0 Substrings can be empty.
•  » » 13 months ago, # ^ | ← Rev. 3 →   0 I'm fought up at test 3 bbabbbaabbbb with my result is 6, while the correct answer is 9. How can i produce a substring with 3 (may-empty) parts that part 1 and 3 contain only 'a' and part 2 contains only 'b'? Really in this case i just can see the result are abbbaa or aabbbb and nothing left!
•  » » » 13 months ago, # ^ |   0 Sorry guys, just ignore it.
 » 13 months ago, # |   0 in problem B can anyone please explain where my approach is wrong.I first created blocks of a's and b's with their respective counts and then i consider the current block is the middle element and if it is 'b' then left and right part could be anything (i.e. bba, bbb, aba, abb) and if current block is 'a' then (aaa, aab, baa) and find the maximum among these (to do this i just calculate the total 'a' and 'b' in the left and right substring respectively).please help me where i am wrong !
•  » » 13 months ago, # ^ |   +1 If the string form is bbb or abb why not considering adding somemore 'a' blocks after it? You may try the input abbbabbba.
•  » » » 13 months ago, # ^ |   0 thanks a lot !!
 » 13 months ago, # |   0 Problem F Why unordered_map is even slower than map? Both TLE on test 11unordered_map use 1450ms on test 10 map use only 576ms array use 249ms on test 10
 » 13 months ago, # |   0 31659292 877B - Nikita and string Hey can somebody help me find out what is wrong with my solution to B — Nikita and String. I got wrong answer in test case 37. Thanks.
•  » » 13 months ago, # ^ |   0 It's easy to see. You did not consider the case when the string contains only a's.
 » 13 months ago, # |   0 In div2 D, what ever i do, i always get MLE at test case 5 with this solution:31687090 .why? How can i fix it?
•  » » 13 months ago, # ^ |   +1 Make sure you didn't enter in an infinite loop with your bfs.
 » 13 months ago, # |   -8 Where Can I find Tutorials ?
•  » » 13 months ago, # ^ |   0
 » 13 months ago, # |   0 anyone can help to explain why in second sample case for problem C. Slava and tanks can destroy all the tanks? The solution doesn't drop a bomb in 4th cell.
•  » » 13 months ago, # ^ |   0 There are only 3 cells
•  » » » 13 months ago, # ^ |   0 Oh my bad, I mistakenly saw 4 as an input instead of output. Thanks
 » 13 months ago, # |   +3 http://codeforces.com/contest/877/problem/C link not working . why?