### MikeMirzayanov's blog

By MikeMirzayanov, 3 years ago, translation, ,

Hello!

ACM-ICPC Southern Subregional Contest (NEERC/Northern Eurasia) 2017 has ended on October 18. There were 73 teams onsite in Saratov, most of them were invited because of their result on the qualification stage.

I invite ACM-ICPC teams and individual participants of Codeforces competitions to take part! Sure, the contest will be unrated.

MikeMirzayanov

• +122

 » 3 years ago, # |   +15 Great opportunity for preparation
 » 3 years ago, # |   -126 Is it rated?
•  » » 3 years ago, # ^ |   +2 It is not rated.
 » 3 years ago, # |   -92 Is it rated?
•  » » 3 years ago, # ^ |   -33 surely won't.
 » 3 years ago, # |   -15 Will it be more Div1 or Div2 oriented? Asking this because last NEERC round was of Div2 difficulty.
•  » » 3 years ago, # ^ |   +9 It will be interesting for both divisions.
 » 3 years ago, # |   0 One computer for one team?
•  » » 3 years ago, # ^ |   0 Preferred, I guess.
 » 3 years ago, # |   +6 ACM-ICPC Rules,Is it similar to normal codeforces competition for submission or different. In following terms - Will there system cases apart from pretest. And what's penalty rules.
 » 3 years ago, # |   +13 Are you going to post editorial?
 » 3 years ago, # |   +9 In C, I fixed the number of times I used the first package, and based on that calculated the minimum number of times I need to use the second package to satisfy the time constraint.I got a lot of WAs on test 80 using this. But then I added a single line to swap the two packages if t2 < t1 and got AC.I am unable to prove why always fixing the cheaper package is correct. Can someone please explain? Also, how to solve B?
•  » » 3 years ago, # ^ |   0 Hm, I came up with exactly the same colution and had WA89. After you suggestion I swaped packages if t2 < t1 and got AC in practice too...
•  » » 3 years ago, # ^ | ← Rev. 2 →   +15 Basically in the optimal solution it's possible that you won't be using some package fully, because you will have already downloaded the file. Thus it's better to choose the slower of the 2 package types as the one you won't be using completely, that's why you need to swap or just do one swap in the beginning.
•  » » » 3 years ago, # ^ |   0 Oh, right. I think I got it. Thanks!
•  » » 3 years ago, # ^ |   +23 B: If graph has a cycle, answer is obviously -1. Otherwise, compute maximum possible for each vertex. Sort all vertices by that values. Go from smallest to largest, greedily select the minimum values which doesn't present yet.
 » 3 years ago, # |   0 Where can we find the onsite results?
•  » » 3 years ago, # ^ |   +13
 » 3 years ago, # |   +5 How to solve J? Was it greedy?
•  » » 3 years ago, # ^ | ← Rev. 2 →   +20 We will always demolish a building as late as possible.For each building, find the highest month such that money for that month >= renovation cost of this building.Then go in inc order of months and destroy buildings greedily, i.e choose to destroy a building if it costs less than the money you have currently. Additionally, you may choose to "undestroy" a previously destroyed building in favour of a new cheaper building. See code for details.Code
 » 3 years ago, # |   +54 Bitset works much better than FFT!
•  » » 3 years ago, # ^ |   +37
 » 3 years ago, # | ← Rev. 2 →   +72 bitset works much better than fft rank 1FFT works better than bitset rank 20 lol
•  » » 3 years ago, # ^ |   +22 It turns out that we are right lol.
 » 3 years ago, # |   +2 When will the test cases be visible?
 » 3 years ago, # |   +4 Why access to the solutions is restricted?
 » 3 years ago, # |   +3 How to solve G and K?
•  » » 3 years ago, # ^ |   +9 G: For min:Start from dfs from s. In the dfs (let the current vertex be u) if there is an adjacent undirected edge to v direct it like u <- v. Run dfs from the adjacent vertices.For max:Start from dfs from s. In the dfs (let the current vertex be u) if there is an adjacent undirected edge to v direct it like u -> v. Run dfs from the adjacent vertices. Code
•  » » » 3 years ago, # ^ |   0 Sorry for the stupid question but how do you get the intuition that this greedy is optimal?
•  » » » » 3 years ago, # ^ |   +5 For maximum:If we are in u and there is an unirected edge to v, there are two options:We go through this edge and we visit vertex v (we direct it like u -> v). This way we will increase our dfs tree.The other option is to direct the edge like u <- v. This way we will use this edge, only if we go to v from another path, and then visit u, but this won't increase the answer, as we have already visited u.From here we conclude that it's always best to direct edges like u -> v.For minimum:If we are in u and there is an unirected edge to v, there are again two options:We go through this edge and we visit vertex v (we direct it like u -> v). This way we will increase our dfs tree. Well we don't want to increase it.The other option is again to direct it like u <- v. Well this is optimal because this way we will actually reach only the vertices, reachable from s using the already directed edges.From here we conclude that it's always best to direct edges like u <- v.
•  » » » 3 years ago, # ^ |   0 Thank you. Do you also know the solution for K?
•  » » » » 3 years ago, # ^ |   +6 it seems G is also solved by greedy algorithm. loop from left to right and then from right to left to make "s[i]<=s[pre]+1" sufficient. searching for explanations... 31557013
•  » » » » 3 years ago, # ^ |   +5 K: x[0] = s[0] + g[0] x[i] = min(x[i - 1] + 1, s[i] + g[i]), i = 1..n - 1 y[n - 1] = s[n - 1] + g[n - 1] y[i] = min(y[i + 1] + 1, s[i] + g[i]), i = n - 2..0 s'[i] = min(x[i], y[i])If s[i] ≤ s'[i] ≤ s[i] + g[i] for all i, then otherwise —  - 1
•  » » » » » 3 years ago, # ^ |   0 Why is this correct?
•  » » » » » » 3 years ago, # ^ |   0 I proved it by submitting and getting AC :)Actually we should find extremum(for minimum) points and simply make stairs between them. It looks like this: ./\./\./\./\.
 » 3 years ago, # |   +11 Is there any editorial available for this contest?
•  » » 3 years ago, # ^ |   -14 follow
 » 3 years ago, # |   0 For question E i first took all the possible strings (indices) and then run a loop from 'a 'to 'z' including character only if it is not visited(not unfolded) and frequency of this character in all possible strings is equal to number of strings which means that it is occurring in every possible candidate of hidden string. Hence this character can be counted. But i could not use any data structure efficiently for this. Can someone please suggest some better one !!Thanks in advance :)
 » 3 years ago, # |   0 For problem number H. When I want to copy case number 7 why it copied 45 f3409ufEFU1BQZKqdp2CV3QV5nUEsqSg1ygegLmqRygj? :(
 » 3 years ago, # |   0 I'm so stupid in the match time.I had wanted to rush A but I wrote an 'I' to 'l',then I was wrong for 3 times!I'm so sad and it's not a good day!
 » 3 years ago, # |   +6 what is the idea of problem I ? and are there many ways to implement it ?
•  » » 3 years ago, # ^ |   +6 It is pretty obvious that the array should be sorted first and then each partition will be a subarray of this sorted array. We do a binary search on the answer ans. To do so, we need to know whether we can divide the array such that each partition has size atleast k and the difference of each partition can be at most ans. We can solve this by dp. Let dp[i] be 1 if we can partition a[1...i] according to the stated condition. Now, consider the partition the i th element is in. The previous partition can end in at most the i - k th index. Also, consider the last element which is less than a[i] - ans. The current partition must start after that element. So, if any of the dp values within this range is 1, then we can set dp[i] = 1, otherwise it is zero. So, we need to check whether any of the dp values within a range is 1. We can easily do so by keeping a BIT on the dp values.
•  » » » 3 years ago, # ^ | ← Rev. 2 →   +5 Instead of a BIT, you can also just keep a pointer. Here is my solution — http://codeforces.com/contest/883/submission/31580263
•  » » » » 3 years ago, # ^ |   +3 Now that you say it, we don't need bit, because we are doing no extra updates, we are updating each value exactly once, so a prefix sum array works just fine.
•  » » » » » 3 years ago, # ^ | ← Rev. 3 →   0 can you please look at my code once, i have tried the same approach as you told but it gave me WA at test 64 !
 » 3 years ago, # |   +3 In question I after fixing the answer how to check wether this answer is possible or not?
 » 3 years ago, # |   0 I really enjoyed this one :) thanks you ^^
 » 3 years ago, # |   +52 Why is it that solved problems in this contest do not appear as solved in the UI (that is with green coloring)? Every other contest is fine for me I think.
•  » » 3 years ago, # ^ |   -28 Perhaps it may be because it is team contest.
•  » » » 3 years ago, # ^ |   +22 I soloed the contest and only 2 of my solved problems are marked with green. It's probably a bug.
•  » » » » 3 years ago, # ^ |   0 In my case I cannot see the problems I have solved in that contest, everything is just colored as white.
 » 3 years ago, # |   0 How to solve B,my solution got WA and can not deal with all the situation TnT
 » 3 years ago, # |   0 Hi, in Problem H, for the test "20 qqqoqqoqMoqMMMqqMMqM", my program outputs "4 MMMMM oqoqo qqMqq qqMqq ", and the result is "wrong answer Incorrect cut". I don't know why it is incorrect cut? Can anyone explain this?
•  » » 3 years ago, # ^ |   +3 Your program outputs "4 MMMMM MoooM qqoqq qqoqq" Which as you can see, reduces q count by 2, and increases o count by 2
•  » » » 3 years ago, # ^ |   0 I see, thanks.
 » 3 years ago, # |   +3 How to solve D and L?
 » 3 years ago, # |   0 http://codeforces.com/contest/877/problem/C link does not working . Why?
 » 3 years ago, # | ← Rev. 3 →   0 SubmissionHow isn't "qqqqoqqqq" valid?!
•  » » 3 years ago, # ^ |   +1 You need to have as more palindroms as possible
•  » » » 3 years ago, # ^ |   0 determine the minimum number of palindromes of equal lengths to cut s into
•  » » » » 3 years ago, # ^ |   +1 ah, sorry, i read solution wrongyour submission is wrong because you don't use all characters from given string