+37
Marcin_smu, you lucky bastard :P 
Created or updated the text 
0
I got the answer from I_love_natalia. It seems memory allocator/deallocator are slow on RCC. I guess my solution was slow because I used too much vectors/priority_queues. 
+5
Thank you! To RussianCodeCup: I still don't know why I got TLE for E during the contest. My submission is #27152353 of http://codeforces.com/gym/101397/status/E, and it's much faster (2027ms) than genomes_iz_2modules.cpp (2870ms). Is it possible that my code works very slowly on RCC's server? 
+30
Sorry for long delay, contest has been added (finally!) to gyms: 2017 Russian Code Cup (RCC 17), Elimination Round 
0
0n25, already mentioned that Codeforces have internal error which not allow add problems to gym. They will be added after problem will be resolved. 
0
Will there be a place to submit solutions after the contest? 
+15
My solution (http://ideone.com/ahuhnB) is a little different from described here. For each point I generate a set of vectors from it. The number of right and obtuse triangles is equal to number of pairs of vectors with nonpositive scalar product. To find it I rotate the vector and support the set of such vectors. Once it becomes codirectional with one vector I increase number of bad triangles by number in the set. Supporting it is quite simple since a vector enters this set from the moment it coincides with one of orthogonal vectors and leaves after it coincides with another. So I put into the set of events for each point 3 events: add point, query result, remove point. I start with vector slightly above vector (1,0) and make a full circle counterclockwise. 
0
Could someone please paste their implementation of D (which they think is elegant)? 
+3
I mean how can I use the checker to check my solution on my computer. I don't see a main function in the checker, and I see a lot of "import ..." that I've never seen before. Sorry for my inexperience with Java. 
0
You can try DFS, you just need hash table to check point exists or not and same for visited. 
+3
How to use the checker for problem C on my computer ? 
0
Just count for every vertex v, number of pairs (u1<u2) ui!=v, such that Ang(u1vu2) < 90. Then you just need to subtract 2 * binom_coef(n,3). 
0
What is solution for D? 
0
No, you just have not to get position (0,y) or (x,0) at the end (to make both subsequences not empty). 
0
If we take n vertices of regular ngon then the answer will be about . 
+8
My solution is O(N^{2}), but it didn't pass test 9 because of the corner case. I greedily construct the answer one by one. I store the set of pairs of prefixes of a and b I used to construct the answer up till now. It has size O(N), because for each prefix of a we're only interested in the shortest prefix of b. For the given pair of prefixes, we can take any element, after which there's enough elements to construct the rest. We need the smallest, so we can take RMQ over the next allowed elements in O(1) for each pair, and find minimum over the pairs. Now, we need to advance the prefixes to reach the chosen element. To do that, we can just construct arrays of pointers to the next occurrence of this element in both arrays in O(N + M). 
+18
Yes. 
0
Is the final round online? 
0
How close can the answer in problem D (about triangles) be to for a huge n? Tried to come up with several tests but answer turned out to be small all the time 
0
So, you don't fix the number of elements chosen from each array? 
+1
We just construe answer one by one and for each position in either array keep track of minimal position in the other array such that we can construe prefix of answer we have so far from corresponding prefixes of arrays 
+3
I used min segment tree for creating subsequences and O(N * log(N)) suffix array to merge them and it passed. 
Created or updated the text 
0
There is a solution for n^2log. You check symbols one by one for nlogn and also keep in mind dp[x] = min{y, you could have finished known prefix with xprefix of a and yprefix of b}. 
0
Same. Quite atificial condition that we can get rid of just by adding following to the end:

+18
Got WA#9 in problem E because missed the fact that both subsequences must be nonempty... 
+3
What's the intended solution for E? priority_queue for getting subarrays and binary search + hash for merging sequences get TL. 
+149
When you are one of the few people (3 to be exact) who solved F and you didn't get a Tshirt, because you forgot that in Russian Code Cup all problems are worth the same :') 
+5
Top 200 
0
Tshirts? 
Created or updated the text 
0
No idea what is stack limit in Visual C++, but I submitted it in g++14 which is compiled with stack=67108864 what means there is 64MB limit on stack. 
0
Did you submitted on Visual C++? It seem to there are very strict stack limit on VC++, but isn,t on g++. 
+20

0
Same here... But, sadly, I didn't pass D during contest even with FastIO and some optimizations. Code that got TLE on RCC got AC easily on CF in about 400 ms. Most frustrating is wasting more than one hour trying to make it fit in time limit. 
+57
Great, after learning that RCC has stack limit I also learned that I was constantly getting WA in E on test #2 because RCC is judged on Windows that has fu^&*# up rand() :/. 
0
There was a stack limit, however a pretty big one as for existing stack limits — 64MB. I submitted on CF code that got RTE on RCC and it got AC using 96MB. 
0
Hmm, I was doing recursive DFS in D, so it probably would have failed if there was a stack limit. Something else that I didn't like though was getting TLE in D, which I fixed using FastIO :) 
+25
Contest has been added to gyms 2017 Russian Code Cup (RCC 17), 3rd qualification round 
+93
The problem is exactly the same, indeed. I am sorry about that, we made it from scratch. None of our writers or testers noted that they saw it before, although some of them, as I see now, indeed did participate in the corresponding round. There are tons of problems in the internet, so simple problems are almost certainly similar to some former ones. Of course, if we see exactly the same problem, we always replace one. We just didn't notice that this time. Hope it didn't affect most participants. 
+123
Is this 21st century? Can somebody confirm? I am not sure because I have just participated in a contest with a stack limit. Come on guys, it's pathetic. 
Created or updated the text 
+36

0
Hi, can you write your email in a personal? 
0
I am not able to submit solutions as "You are not registered to the round. So you can not send solutions.". Is there anyway to register after the round has started? 
24
Thanks.Good luck 
19
Good luck to everyone, hopefully we will classify for the next round! 
Created or updated the text 
0
fixed :) 
0

+10
when? It hasn't been posted yet. 
0
Sure. You will be able to get it later in the trainings section 
+42
Will the problems get added to Gym like Qualification Round 1? 
0
Nice trick! 
0
Yes 
+8
My solution is similar to hellman_'s one, except a trick to avoid log factor in the complexity :). Maintain two array a[], b[]. When adding/removing a segment of leng d we add/substract one from a[d / sqrt(N)] and b[d]. To find the maximal len, we need only O(sqrt(N)). 
Created or updated the text 
0
I tried to, but got TLE :( First, transform array into prefix sums + lift it up by 100000 to avoid negative values. So our goal is to find longest interval such that arr[l] = arr[r] inside the quered interval. We start MO's algorithm and check intervals. We maintain:
At the end of block check, we can clear the multiset directly, and clean the deque's by collapsing the current interval. PS: I used map<int,int> instead of multiset. 
+9
The edge here signifies (ind,arr(ind)) ??? 
0
Very Nice, So chemthan, Please explain your solution . 
0
Yes, it does. I solved it by MO. 
0
The answer to the fully given array = N — number of cycles. So you collect all cycle segments (e.g. ? > 1 > 4 > 5 > ?) where ? is controlled by you. If you have one segment — you have no choice (just put one element you have). Otherwise you can connect all segments into a one cycle (e.g. end0 > start1, end1 >start2, ... endI>start0), thus maximizing the answer. 
0
Minimize the number of cycles. 
0
I have a feeling that E can be solved using MO's Algorithm but I don't know how xD So Can Someone Help Me ? 
+17
How to solve C? 
+21
I qualified in the previous round. Can I take part in this round unofficially? 
+13
Yes. They said there was a problem with the post and they're going to send it again. 
0
Thanks for the link! Did you end up with a reply? 
+18
http://codeforces.com/blog/entry/51001#comment349145 by the way, the typo was really funny :D 
+18
Oh my gosh — thanks :P That wasn't intended! 
0
Don't be so critical! 
+18
Has anybody received their shirts from last year? EDIT: oops... that was an unfortunate typo! 
0
If I qualified to the elimination round, how can I receive the certificate and I'm live in Egypt ?! 
Created or updated the text 
0
Is this contest for more than a specific rating or for anyone ? 
+1
In the case when answer is "YES" we know that all the segments have length < k. Consider any such segment. Assume that the segment is horizontal. Same argument will work when it is vertical. For this horizontal segment i is constant. So in (i+j)%k will be different for each of those tiles in the segment. As we are incrementing it by 1 modulo k each time while moving along the segment. 
0
Thanks again! I understood what was the problem. It worked after removing this ambiguity. 
0
why ((i + j) % k) + 1 works ? 
+4
I didn't understand the statement but managed to guess it from the samples. The explanation for samples would be so useful. 
0
Ok, I see, thanks! 
+5
No. You can return twice false only for exactly the same elements. Think of it in the way: would a correct sorting of [x, y] be [x, x]? If not, then you can't treat them as equal. And that's the case here. You can check out c++ strict weak ordering for more information about comparators. 
0
But if I have d1 = d2. Then it is like I am assuming x = y. So in that case shouldn't it be alright to return false both the times? 
0
That's it. Just open that files in any text editor. There are few files, but each contains a lot of internal tests. *.a files are expected answers. Btw, your answers for B can be different, that in .a files, but also correct, because there can be more than one correct answer. 
+5
For any x!=y you need the function to return true exactly once for x<y and y<x. Without these two lines it may return false twice if d1=d2. I usually return lexicographical order in such cases like your d1=d2. 
0
ohh Thanks! I removed those two lines, but now it started giving WA in test case 3. 
+11
Your comparing function can return x<y and y<x for some triples x,y (e.g. both having a=b) and the sorting enters infinite loop. 
+5
Here it is. 
0
Can anyone please give working C++ code? 
+5
Can you elaborate?? How with bipartite matching. PS: I dint mean adjacent. 
0
I downloaded tests, but in russiancodecup2017qual1/b/tests I can onlu see files named "01", "01.a", "02", "02.a",... How can I see the tests? I am using OS X 
0
With Bipartite matching. 
0
Same here. 
0
Ohh ,I overlooked the word contiguous tiles and was always trying for contiguous segments. Can the question be solved for contiguous segments (instead of tiles) or is it NP? 
0
teja349 it means continuous 1's in array. 
+26
First Qualification round has been added to gyms: 2017 Russian Code Cup (RCC 17), 1st qualification round 
+21
It is not possible to submit solution to system after contest, as far as I know, but instead of that you can download tests and check yourself :) UPD: It added to gyms, here :) 
+6
can you please explain it.I m still trying to figure it out. 
0
Yes, you're right. I thought my code worked in that case but now I see that I was wrong. Thanks! 
+16
Does anyone know where can I submit solution after the contest is over? 
Name 
