### AGrigorii's blog

By AGrigorii, 17 months ago, translation, ,

Hello, Codeforces!

I'd like to invite you to Codeforces Round #484 (Div. 2). It'll be held on May/17/2018 19:35 (Moscow time) and Div. 1 participants can join it out of competition. Please pay attention that round starts in the unusual time!

Me and Andrey API Pikas prepared the tasks for this round.

Great thanks to Nikolay KAN Kalinin for helping us preparing the contest, to Mikhail MikeMirzayanov Mirzayanov for the great Polygon platform and Codeforces and also to Kirill KittyLover Samelyuk, Nikolay Apollon76 Permyakov, Dmitry Krainov_Dmitry Krainov, Andrey GreenGrape Rayskiy and Alexey Um_nik Danilyuk for writing solutions.

You'll have to solve six tasks in two hours. The scoring distribution will be announced later

Good luck!

UPD Score distribution 500-1000-1500-2000-2500-3000

UPD2 Congratulations to the winners of the division 2:

And also our congratulations to the winners of both divisions:

UPD3 The editorial will be published tomorrow.

UPD4 Editorial

• +181

 » 17 months ago, # |   -40 Is there div 3 and is div 3 rated?
•  » » 17 months ago, # ^ |   0 Div2 rounds are rated for people on div3 too
•  » » 17 months ago, # ^ | ← Rev. 2 →   +9 Questions about div3 is getting more annoying than "Is it rated?". Seriously, stop."Div 3" means there is the special contests rated only for people under 1600. Nothing more. "Div 3" does not exists anywhere except for the special "div 3" rounds.
•  » » » 17 months ago, # ^ |   -16 Is it UNRATED?
•  » » » » 17 months ago, # ^ |   0
 » 17 months ago, # |   +24 Great :). You could fix timeanddate.com link to make it display time in user's timezone. Take a look on Mike's comment: http://codeforces.com/blog/entry/59322?#comment-429178Displayed time screenshots of #483 and #484:
•  » » 17 months ago, # ^ |   +15 Thank you! It looks better now (:
 » 17 months ago, # |   +16 Yeaaa! Round by my favourite problemsetter! I waited it so long. <3 <3 <3I think, I can become Candidate Master tomorrow.
•  » » 17 months ago, # ^ |   +10 Hi, bro! It seems that I can upgrade my color too!
 » 17 months ago, # | ← Rev. 2 →   +21 Third palindrome round in 2018 !!
•  » » 17 months ago, # ^ |   0 What do you mean?
•  » » » 17 months ago, # ^ |   +4 Number of the round is palindrome :)
•  » » » 17 months ago, # ^ |   +8 484 is the number of the round and it's palindrome.
•  » » » » 17 months ago, # ^ |   -57 I already know that.Downvoted u
•  » » 17 months ago, # ^ |   +31 The first square round in 2018!
•  » » » 17 months ago, # ^ | ← Rev. 2 →   +50 The first square, whose each digit is a power of two, the second digit is the first time two, the third is the second divided by two, for division two, and each digit of the square root of the round number is two, and dividing the square root of the round number by two gives a number whose digits sum to two.
•  » » » » 17 months ago, # ^ |   +278
•  » » » » 17 months ago, # ^ |   +19 Damn, I forgot that the sum of the digits is a power of two, more precisely 2^2^2.
•  » » » » 17 months ago, # ^ |   +21 In case you didn't have enough...484 = 222
•  » » » » » 17 months ago, # ^ | ← Rev. 2 →   +42 never enough ...22 = 17 + 5 : date of contest ² = div 2
 » 17 months ago, # | ← Rev. 5 →   -45 ...
 » 17 months ago, # |   -25 I smell a lot of hacks
•  » » 17 months ago, # ^ |   0 I smell easy C and ot hard D
 » 17 months ago, # |   +21 Q. Why do you start blushing when a new Codeforces round is announced?A. It turns me Red. ^_^
•  » » 17 months ago, # ^ |   -19 How can div. 2 only contest make specialist a gradmaster? Does this make any sence to you?
•  » » » 17 months ago, # ^ |   +9 It is a joke. I am not talking about myself.
 » 17 months ago, # |   +4 is it rated for purples ?
•  » » 17 months ago, # ^ |   0 Purple users are rated in div2-only contests since rating system change. See http://codeforces.com/blog/entry/59228 for more details.
 » 17 months ago, # |   -36 Should have a contest on yesterday. 13,14,15,17....why missed 16??
•  » » 17 months ago, # ^ |   +18 There was one in gym yesterday too.
•  » » » 17 months ago, # ^ |   +13 I didn't notice....my bad..
 » 17 months ago, # |   -17 What about for Div 3 members?
•  » » 17 months ago, # ^ |   -26 Most contests in Codeforces:1) Div.1 + Div.2: Candidate masters and higher (1900 and higher) will be in the first division while experts and lower (lower than 1900) will be in the second division2) Div.2 Only: Candidate master and lower (lower than 2100)3) Div.3: Specialist and lower (lower than 1600)So please stop commenting the same question every contest.
•  » » » 17 months ago, # ^ |   +35 Hey, sorry that I'm coming here only now in 2 or more month.
•  » » » » 17 months ago, # ^ |   0 Irony, div 3 came around 2 weeks ago.
•  » » » » 17 months ago, # ^ | ← Rev. 2 →   -53 Then please search before asking. BTW welcome again :D
 » 17 months ago, # |   -21 Hii
 » 17 months ago, # |   -35 Wish high ratings to all.
 » 17 months ago, # |   -17 If i remember correctly, now the contest is delayed by 1 hour compared to original announcement, which is not good for people waiting for this contest.
 » 17 months ago, # |   -50 Bad timing for the user all over the world
 » 17 months ago, # |   +130 I hope this round won't be like that
•  » » 17 months ago, # ^ |   +1 Guess I'm a faithful guy...
•  » » 17 months ago, # ^ |   0 Hacking is such a ridiculous thing, maybe good for some guys but unfair... But not always bad, the stress and excitement is cool, agree?
 » 17 months ago, # |   -20 no a good time but i like it!:)
 » 17 months ago, # |   -11 better starting time for Bangladeshi contestant....
 » 17 months ago, # |   0 Can't open problem C and D. Showing Error !!
•  » » 17 months ago, # ^ |   -23 Have you tried restarting your computer or opening Chodeforces in a different browser?
 » 17 months ago, # |   -12 The comment removed because of Codeforces rules violation
 » 17 months ago, # |   +66 How to solve F?
•  » » 17 months ago, # ^ | ← Rev. 4 →   +26 If we look at the dfs tree of the graph: If we got any backward edge (an edge connecting a node to one of its ancestors) then the answer must be one of the nodes between the two endpoints. If there is not such edge then answer is -1. If we got another backward edge then we need to find the intersection (or remove nodes from solution which are ancestor of the other node or are not ancestor of the current node). For example, 1 -> 2 -> 3 -> 4 is a cycle, and 2 -> 3 -> 5 is another cycle. Both 4 -> 1 and 5 -> 2 are backward edges. If we got a cross edge (edge connecting a node to another that is neither its ancestor or descendant) then if the other node is in cycle and topmost node of the cycle is a parent of the current node, we need to erase the nodes that are neither parent to the current node nor descendant of the other node. For example, 7->4 is a cross edge. Submission as a reference: 38382900
•  » » » 17 months ago, # ^ |   +8 Hi there, I am struggling hard with this problem. So I studied your code quite a bit, and found a mistake in it. Try the following test case: 6 9 1 2 2 3 3 4 4 1 4 2 3 5 5 6 6 4 1 6 Solution should be 4, but your program answers -1.The last edge 1->6 in this test case is a cross edge. So you have to delete all vertices on the cycle 1->2->3->4->1 that are anchestors of 6, but not of 1. Finding the lowest anchestor of 1 on the cycle works (it is 1 itself). But finding the lowest anchestor of 6 doesn't work, since you argument with the height h of 6, which has nothing to do with the ancestors.
 » 17 months ago, # |   +8 How to solve problem D?
•  » » 17 months ago, # ^ |   +6 You can brute force for all posible k using sets in O(nlogn).
•  » » » 17 months ago, # ^ |   +9 what is the test 5 ?
•  » » » » 17 months ago, # ^ |   +5 I used co-ordinate compression. I got WA TC #5 when I was printing K in terms of the compressed value instead of the real value.
•  » » » » » 17 months ago, # ^ | ← Rev. 3 →   +3 I got WA on test 5 for a different reason.My answer: 57209037Judge: 45567032My algo iterated a values as candidates for k. When a is sorted by size, these values are consecutive in the input:57209037 (found best solution at this value)45567031 (found worse solution at this value)Obviously, the best solution can also be found at 45567031+1.
•  » » » » 17 months ago, # ^ |   +1 If anyone needs complete test 5 input, I've put it here: https://pastebin.com/vHuv6LE4
•  » » » 17 months ago, # ^ |   0 What is stored in the sets? Also... Brute force requires to iterate through the whole array right?
•  » » » » 17 months ago, # ^ | ← Rev. 3 →   +3 We can store lengths of locations and when they are reached, with a array or bst like std::set or std::map. To do this we can sort the sequence and enumerate k from 1 to n, using disjoint sets.
•  » » » 17 months ago, # ^ |   0 Can you elaborate please?
•  » » » 17 months ago, # ^ |   0 based on this we can simply use an array instead of std::set, thus we can do this step in O(n).
•  » » 17 months ago, # ^ |   +3 And of course k can only be equal to a[i] + 1
•  » » » 17 months ago, # ^ |   0 I got the k=ai+1 part during the contest but can you tell me about how to brute force ??
•  » » » » 17 months ago, # ^ | ← Rev. 4 →   +9 I have one set to store segments of elements less than k and one multiset to store lengths of all segments in first set. Then i add all a[i] from the smallest to the biggest, where current k = a[i] + 1. When you add one there're three scenarios: it forms a new segment, it unites with one segment, it merges two segments together. I think it's clear how to do updates and how to keep multiset of length.
•  » » » » » 17 months ago, # ^ |   0 Oh thanks I get it.
•  » » » » » 17 months ago, # ^ |   +8 Alternately, start with the segment [1...n], and add a[i] from largest to smallest. This way, it's guaranteed that the only operation happening is breaking up an existing segment, which makes implementation easier.
•  » » » » 17 months ago, # ^ | ← Rev. 2 →   +3 So when at some step segment set size is begger than it's sizes at all previous steps and when all elements in multiset are equal I update the answer with a[i] + 1.
•  » » » 17 months ago, # ^ |   0 I thought of this, forgot to implement it because the samples didn't need it, and managed to implement it with about 10 seconds to spare in the contest....Needless to say, I wasn't able to submit in time :(Ah Codeforces, thou art a cruel mistress...
•  » » 17 months ago, # ^ |   +26 Maintain a dsu of active indices and process the indices with increasing order of values. At each step, let cur_k be value + 1. Check if neighboring indices are active and accordingly merge them. Also maintain the count of total active indices for a given size of set. Update the answer if the current size is equal to total active indices.
 » 17 months ago, # |   -22 Problems are very hackable !
 » 17 months ago, # |   +61 the solution to problem c was available at https://www.geeksforgeeks.org/maximum-edge-removal-tree-make-even-forest/
•  » » 17 months ago, # ^ |   +12 I took 30mins to solve it. Authors need to be more cautious before preparing a problem. :(
•  » » 17 months ago, # ^ |   +6 striver_79 try to solve problems rather than searching for problems
•  » » » 17 months ago, # ^ |   +2 haha, if I was to search for the problem, I would have got all the pretests passed in 5 minutes. I tried for an hour, but when I did fail for it, then I was searching for the DFS part when I came across it. Learn to observe before saying something. :)
•  » » » » 17 months ago, # ^ | ← Rev. 2 →   +7 Looking for the dfs part and then came across that nice explanation btw what are you looking in DFS. "WHAT TO OBSERVE". I also type DFS in google but I didn't came across that question maybe your browser is a legendary one.
•  » » » » » 17 months ago, # ^ |   +7 I do not owe an explanation to you that is for sure buddy. And stop blaming someone for pointing out a link which seems similar. :) I guess you learn everything without googling. You got so much of inner talent :)
•  » » » » » » 17 months ago, # ^ |   +1 But learning is not googling in between the contest. In between try to apply your own mind.
•  » » » » » » » 17 months ago, # ^ |   +3 grab popcorn :P
•  » » » » » » » » 17 months ago, # ^ |   0 *grabs
 » 17 months ago, # | ← Rev. 2 →   0 Problem E can be solved by the fact that this rectangle can be mirrored adjacently on the coordinate plane.No, I didn't solve it.I've done a similar problem in Google Foobar. If I had been given 40 mins I could've solved it. :(
 » 17 months ago, # | ← Rev. 2 →   0 What is the 6th pretest in C?
 » 17 months ago, # |   +38 Problem C is available at Hacker Rank: Your text to link here... . Check this out..
 » 17 months ago, # |   +11 I read "connected components with equal size" instead of "even size" in C. Yikes
 » 17 months ago, # |   +23 Feedback:C: niceD: A bit ambiguous, I needed two clarifications to understand it. E: The mirroring trick is very standard. I think I've seen a very similar (maybe the same) problem in uva.
•  » » 17 months ago, # ^ |   +3 C was a direct copy from geeks for geeks
•  » » 17 months ago, # ^ |   0 Mirror trick? Can you say sth? I solve it using Chinese remainder theorem.
•  » » 17 months ago, # ^ |   0 Do you know if there's a name for the mirroring trick? I've seen a solution that used it in the past, but I wasn't able to understand it then. I'd like to find more information about it and learn it now.
•  » » » 17 months ago, # ^ |   +3 just consider each side of the table as a mirror and copy the table based on its picture in the mirror. So anytime the ball hit the side it enters the new table and continues its direction.
•  » » » » 17 months ago, # ^ | ← Rev. 3 →   0 I don't understand what algorithm follows this. You calculate the intersetcion point of rectangle and a straight line. If you hit the origin or a corner, you are done. If you hit the wall, you reflect the whole rectangle and keep going.You repeat the above 10^9 and tle.
•  » » » » » 17 months ago, # ^ | ← Rev. 2 →   +20 The point of the reflection isn't to simulate the process: that can be done without the reflection at all. The point of the reflection is: You can now travel in a straight line You get generalized coordinates for the corners: for example, using the labeling in erdos' picture in the other comment, point A will have coordinates (2mk, 2nl) for integers k, l. You can get similar generalized coordinates for the other 3 corners, and then it's simply checking whether integers k and l exist such that the point given by them lies on the line you have, in the direction you want.
•  » » » » » » 17 months ago, # ^ |   +1 Can you please provide a resource link to learn it? Thanks in advance.
•  » » » » » » » 17 months ago, # ^ | ← Rev. 2 →   +1 I'm sorry, but I don't have an online resource for this sort of thing. Given the context, I'm pretty sure that there'll be a few problems of this type discussed on AOPS, so look there maybe?To be honest, this is my first time seeing the reflection being used in a coding problem. I've only used it in maths problems before, but it seems like a nice Olympiad problem trick, so AOPS seems like the place to look.I'll look around a bit and see if I can find something more concrete.
•  » » » » » » » » 17 months ago, # ^ |   0 Thanks, again. :)
•  » » » » » » » 17 months ago, # ^ |   0 This link might be helpful for the proof and solution of diophantine equations.
•  » » » 17 months ago, # ^ |   +78
•  » » » » 17 months ago, # ^ | ← Rev. 2 →   +8 There is a thread in below link which explains the similar case
•  » » 17 months ago, # ^ |   0 I agree with you and saw a couple of problems like E. (e.g. in Google foobar) I'm wondering why did I read it at the end of contest! :-/
 » 17 months ago, # |   +8 I used tree dp to solve C but now i find out that there's some simple solution -_-
•  » » 17 months ago, # ^ |   0 dp solution is pretty simple too
 » 17 months ago, # |   +24 So are you sure what you want us to find in D is what D's statement says? Thus, in the sequence of n days we can find consecutive nonempty segments when the shark traveled the distance less than k in each of the days: each such segment corresponds to one location. Shit in bold's true but it it's not true that each location has a corresponding nonempty set.Now getting back to what the problem asks for: Find such integer k , that the number of locations is as large as possible. And at the same time, what you want us to do is find the k which maximizes the number of nonempty sets, not the number of locations.Even after the announcement, which was too late anyway, nobody bothered to actually update the statement.
•  » » 17 months ago, # ^ |   0 This is because if a shark travels 2 days in a row, he will still be at a new location on the day in between, correct?
•  » » 17 months ago, # ^ |   +3 After reading the problem statement I thought the answer to this test case 8 1 2 7 3 4 8 5 6 should be 0 as it satisfies all the conditions asked i.e 1) the shark was in each location the same number of days, 2) the number of locations is maximum possible satisfying the first condition, 3) k is smallest possible satisfying the first and second conditions
•  » » » 17 months ago, # ^ | ← Rev. 2 →   0 I have the same confusion regarding this problem (but not anymore). Let me help clarify this. Assume the answer is k, one location is counted as non-empty consecutive segment which every number in it is strictly lower than k.For first sample case, if the answer is 7, the number of location is 3, that is {1,2}, {3,4}, {5, 6} and valid because each segment size is two. If you choose 0 as the answer, the number of location is zero. So there's a better answer than 0.
 » 17 months ago, # |   +23 Happy Ramadan holiday to all. I wish happiness and health to everyone.
 » 17 months ago, # | ← Rev. 4 →   +5 This statement didn't exist at the beginning of the contest. My solution was hacked because of it. and there was no clarification about it!!!!!!! AGrigorii [ ]()
•  » » 17 months ago, # ^ |   +7 it did exist
•  » » » 17 months ago, # ^ | ← Rev. 2 →   +16 The If statement didn't
•  » » » 17 months ago, # ^ | ← Rev. 2 →   +17 ajecc No, it didn't exist.
•  » » 17 months ago, # ^ |   +2
•  » » 17 months ago, # ^ |   +26 Actually we missed initially that the note was incorrect for n = 2. The mistake was fixed a few minutes before the round, as soon as MikeMirzayanov spotted it, and the update was pushed from Polygon to CF. It takes some time, but for me the statement opened a minute before the contest already contained the fix, so I decided that everything was ok and I did't have to make an announcement. It turned out that for some people the old, cached statement opened without the fix. Luckily almost everyone understood what we meant correctly.
•  » » » 17 months ago, # ^ |   -13 Till I submitted my solution ,the fix didn't exist. I wrote my solution based on what I read in the statement. It wasn't my mistake.
•  » » » 17 months ago, # ^ |   +8 You cant re-test only A problem without test with size = 2? I think it would be fair
•  » » » 17 months ago, # ^ |   -22 So this is over and my rate decreased beacause of a mistake which is not mine.
•  » » » » 17 months ago, # ^ |   +3 Stop crying over dumb shit. Mistakes happen and this contest is not the end of the world.Also its just -20 which can be recovered very easily.
•  » » » » » 17 months ago, # ^ |   0 As for me, this worsened my result by 45, but I totally agree that this is just a rating, but it's not very pleasant either
 » 17 months ago, # |   -9 A question copied directly from geeksforgeeks, wtf ???? Contest should be unrated.Its a big disgrace.
•  » » 17 months ago, # ^ |   +14 The practice shows that it won't be unrated. There was a case when absolutely the same problem appeared twice even on codeforces itself but the round was rated.
•  » » » 17 months ago, # ^ |   +3 If I am not wrong it was in an educational round, in which the ideas can be common. And it did not affect many div 2 coders. I might be saying this since I performed bad in the contest. But still C was just google and first link and it shouldn't be the case.
•  » » » » 17 months ago, # ^ |   +3 I think there were plenty of "just google and first link" cases too. But still I think we should let coordinators decide whether it's fair or not.
•  » » » » 17 months ago, # ^ | ← Rev. 2 →   +3 I have seen many times(I guess at least 3) where exactly same problem was in other contest, but mostly all of such contests were rated.
•  » » » 17 months ago, # ^ |   -17 Seriously Mike, people copying code from other sites getting more credit than people working their ass off for more than half an hour. Fantastic work Mike.
•  » » 17 months ago, # ^ |   -6 Yes. I carefully thought and coded it for 47 minutes only to realize after contest that it was googleable. Shame !!! -_-
 » 17 months ago, # |   0 Was not able to open all problem statements in one window :( Bug
 » 17 months ago, # |   +3
 » 17 months ago, # |   0 How to solve C?
•  » » 17 months ago, # ^ |   0
 » 17 months ago, # |   +17 o.O
•  » » 17 months ago, # ^ |   +14 I think only his last solution got hacked, and all previous solutions were marked as hacked.
•  » » 17 months ago, # ^ |   0 did he cheated using clone account?
 » 17 months ago, # |   0 What topic should i learn to solve C div2?
•  » » 17 months ago, # ^ |   +6 You should know basic graph theory(specially dfs)
•  » » 17 months ago, # ^ |   0 for problem C, just learn how to Google the statement!
•  » » 17 months ago, # ^ |   0 ...and bfs too. I solved with bfs
•  » » 7 months ago, # ^ |   0 Today, I solved it,,
 » 17 months ago, # | ← Rev. 2 →   +5 Almost same as today's Problem C Is there any difference conceptually ???? May be it is not what the contestant expect from the problem setter..
•  » » 17 months ago, # ^ | ← Rev. 2 →   +16 In the yesterday contest, solution for C was also in Wikipedia.
 » 17 months ago, # | ← Rev. 3 →   -25
 » 17 months ago, # |   -61 I will leave codeforces if the contest is not made unrated, or semirated for the sake of it. But it is not fair for people to copy codes and press submit button.
 » 17 months ago, # |   +24 How to solve C if it would have been a graph with cycles ?
•  » » 17 months ago, # ^ |   -18 tree hasnt got cycles
•  » » » 17 months ago, # ^ | ← Rev. 2 →   +3 I know that. I am just asking how would one go about solving the problem if it would have been a graph with cycles as the approach used for solving the tree one will not work here.
•  » » » » 17 months ago, # ^ |   -11 Sorry, I did not understand correctly what you mean
•  » » » » 17 months ago, # ^ | ← Rev. 5 →   -8 I may be wrong but in case of undirected connected graph we have to consider only those edges which if removed results in more than one connected component otherwise clearly if removal of an edge does not divide the graph then answer depends on n is even or odd. Now for the previous one you can have a look at bridge in a graph --> https://www.geeksforgeeks.org/bridge-in-a-graph/ Removing such edges and doing the same what we did in actual C question should do the thing.But Edges might be of order which does not satisfy the constraints if n is 1e5.By doing the same thing (which i wrote above) i mean that edge should be removed only if it divides two parts in even number (each).
•  » » » » » 17 months ago, # ^ |   0 The approach seems fine but I think finding out Bridges and removing would give "minimum" number of edges required for deletion and not "maximum".
•  » » » » » » 17 months ago, # ^ |   -8 No removing bridges does not govern whether we get minimum or maximum edges. When i say that you remove edge only if it disconnects the graph and both sides nodes should be even. So automatically all the edges which satisfy this property will get counted and that's what we did it in given C we count all those edges which divides the nodes into two even halves. Please correct if i m wrong !!
•  » » » 17 months ago, # ^ |   0 in case of a connected graph ???
 » 17 months ago, # | ← Rev. 2 →   +204 About the choice of wording in condition 1 of A
•  » » 17 months ago, # ^ |   +11 I like this really much!! XD
•  » » 17 months ago, # ^ |   +11 You are worthy of being a problem-settter on codeforces.
 » 17 months ago, # |   0 In Question B why doesn't 3*nlogn pass the test cases. I tried using maps in c++ but it is showing time limit exceeded in test 45 . Can someone point out mistake in my code : Link
•  » » 17 months ago, # ^ |   0 while(used[cnt2]==1) cnt2--; This part doesn't looks like O(1) or O(log n). I think, it's O(n) at worst case (because of "cnt2 = cnt1;" six lines higher).
•  » » » 17 months ago, # ^ |   0 Oh got it. Thanks for helping
 » 17 months ago, # |   +15 Yay, I became master, but sadly only because of div2 rounds.
•  » » 17 months ago, # ^ |   +3 What is the difference? Master is master. If you don't want to participate in div 2, then wait for div1...
•  » » » 17 months ago, # ^ |   +5 well actually its opposite, there are some purples that skip div 1, because they don't want to be beaten up by reds and yellows and join div 2 to compete with blues instead.
•  » » » » 17 months ago, # ^ |   0 They can be beaten up by blues then.
•  » » 17 months ago, # ^ |   +4 I don't understand why everybody is complaining and thinks that it would be easier to get to 2100. The only true thing is that there will be more opportunities to get there. It doesn't mean it would be easier. If you don't deserve 2100 you won't get it, one way or another.For example I already managed to lose a lot of points in div 2 contest on Monday. And today I was 122. If there were no violet coders, I would have been 25'th which would have given me much more rating.
•  » » » 17 months ago, # ^ | ← Rev. 2 →   -31 Lol You don't understand? Before this shit revolution, to get Master(old) you need to most likely solve 3 probs in Div 1 which is equivalent to all div 2 problems. Now get just good ranks which in most case is possible with just 4 div 2 problems. As you can see in this round, 370 officially solved 4th hardest, you think thats good enough for someone Master?"I don't understand why everybody is complaining and thinks that it would be easier to get to 2100" Because it actually is faggot. If you don't understand, then compare how many users have got there maximum rating in past div 2 only rounds.
•  » » » » 17 months ago, # ^ |   0 "to get Div 1 you need to most likely solve 3 probs in Div 1" — makes sense. Sorry about my previous post.
•  » » » » » 17 months ago, # ^ |   -8 TO GET MASTER (OLD VERSION) !
•  » » 17 months ago, # ^ |   +8 You've became at least, not like me :D (9 points)Congradulations!
•  » » » 17 months ago, # ^ | ← Rev. 2 →   0 At least you have a chance to participate to next Div2 round, not like me :D (passed to master with 11 points).Congratulations!
 » 17 months ago, # |   +14 It looks very strange that O(nlogn) solution for D works without any used memory: 38374872.
 » 17 months ago, # | ← Rev. 2 →   +5
•  » » 17 months ago, # ^ |   0 That claim about F is totally ridiculous
•  » » » 17 months ago, # ^ |   +1
•  » » » » 17 months ago, # ^ |   +20 The Quora answer is wrong and comments don't seem to give any hint to actual solution.As for the Polish problem, the translation shows that it is a harder version of Problem F. However, it isn't possible for problem setters to verify that their problems don't exist even on non-English sites.
•  » » » » 17 months ago, # ^ | ← Rev. 2 →   +3 Yes, it's the 4th time that I came across this problem.
•  » » » 17 months ago, # ^ | ← Rev. 2 →   0 It is not. I didn't realize this and now I checked that my incorrect solution to kon (9/10) is accepted after 2 small modifications (for 2 or more disjoint cycles and for empty list of cities).Though I am not sure if I would have been able to figure out the first one during the contest...Anyway, top 5 has gone...
•  » » 17 months ago, # ^ |   0 Sorry but I have to say that CF won't care about such a thing!Sometimes CF copies exact problems from itself though.
•  » » » 17 months ago, # ^ |   +1 It's not copying if the second setter didn't realize that the idea for the problem was already used before.
•  » » » » 17 months ago, # ^ |   0 I mean that they won't care about it after realizing copying.CF be like: do we have issues with the tests? if yes, then it's unrated else it's rated for sure. I've never seen a round to be unrated for a more logical reason.
 » 17 months ago, # |   +39 speed of light coder !! ****
•  » » 17 months ago, # ^ |   0 Wow !
•  » » 17 months ago, # ^ |   0 The guy knows his theory.
 » 17 months ago, # |   +20 I think systests on D are very weak. I found a big mistake in my code after submit but surprisingly gave me an AC. My AC code: http://codeforces.com/contest/982/submission/38384511 A simple test case when my output differs from another AC submissions: 11 7 9 8 100 1 2 3 200 4 5 6 There something invalid in this input?
•  » » 17 months ago, # ^ |   +2 n = 1488 in systests Problemsetter is the best ❤️.
•  » » 17 months ago, # ^ |   0 My AC submission give output 10 and your code output 7. Maybe your code do any undefined behavior?
•  » » » 17 months ago, # ^ |   0 No, its just wrong...
 » 17 months ago, # |   0 In Problem B What if the number of extroverts(1) at any point becomes greater than number of introverts(0)? Many solutions will fail then ![problem:982B]
•  » » 17 months ago, # ^ |   0 It is mentioned in the problem statement itself that there is always a suitable seat for an extrovert, So no such case will occur.
•  » » » 17 months ago, # ^ |   0 My bad ! I didn't understood the problem statement properly and wasted much time :/. Anyway Thanks for help !
•  » » 17 months ago, # ^ |   0 It is guaranteed that the number of extroverts equals the number of introverts (i. e. both numbers equal n), and for each extrovert there always is a suitable row.©
 » 17 months ago, # |   +8 Can someone help me in understanding D ...??
•  » » 17 months ago, # ^ |   +3 For each different k[i] = a[i]+1, you check the size of all the contiguous days with a distance covered strictly less than k[i].You go through all the a[i] in ascending order.if a[i] does not have a neighbour lower than him, it creates a new contiguous day sequence of length 1. Then, you merge it with his neighbour(s) (if they are lower than a[i]), which destroys their sequence and creates a new sequence of length 1 + total length of the sequences of the neighbours. It's important because you need to keep track of how many different lengths of sequences you have at all time, cause you will need it at each step.To keep track of how many different lengths of sequences you have after each a[i], you can create a table that tracks how many sequences each length has, and a variable that tracks how many lengths you have (that you increase by one each time you insert a sequence whose length is not represented yet, and decrease whenever you remove the last sequence of a given size). If there is only one length in the table, then you know that the number of sequences for k[i] is (number of distances <=a[i]) /(only length of sequence represented).The answer is the minimum k[i] that leads to the maximum value of this ratio. You can do the merge with an union/find, making the merging a O(n*log(n)), and computing the ratio each time can be done in constant time, leading to (I think) a solution in O(n*log(n)).
•  » » » 17 months ago, # ^ |   +1 Got it..... thanks a lot !!!
 » 17 months ago, # |   0 AGrigorii When is the editorial gonna be published? If it's already published in Russian, please do provide the link. Thanks
•  » » 17 months ago, # ^ |   +4 Sorry. I have a long trip to another city. Few moments later but today
•  » » 17 months ago, # ^ |   0
•  » » » 17 months ago, # ^ |   0 Thanks
 » 17 months ago, # |   +21 I found a surprisingly simple solution for F. The key observation is that if you have a node with an outdegree of 1, you can delete that node and push all incoming nodes to the successor (with a special case for self-loops). This process can reduce the number of edges if an incoming node was already pointing to the successor node.As an example, node 3 in the image below can be deleted since it has only one outgoing edge:Which results in:Note that this reduced the outdegree of node 1, making it now eligible for deletion.If you have more than one node remaining after this reduction, then the answer is impossible. I haven't tried to prove this, but it resulted in an AC submission. :)For each node, it is essential to maintain an unordered_set for incoming and outgoing nodes to detect duplicate edges. This makes it slightly slower (due to the set operations), but it's fast enough to pass in C++ (albeit not in Java, from my experience). My accepted submission: 38409568.
•  » » 17 months ago, # ^ | ← Rev. 2 →   0 The problem is in your while loop: while(n-->0){ arr[idx] = Integer.valueOf(str.split(" ")[idx]); imap.put(Integer.valueOf(str.split(" ")[idx++]), cnt++); } it gives n^2 because you parse the whole string each iteration. Parse it once before the loop (http://codeforces.com/contest/982/submission/38451293)