Today I have a lot of free time. I was looking for competitions today, and I found only one:
DMPG '15 — Gold Division (Open Unofficial Mirror)
Contest site https://dmoj.ca/
Contest isn't very popular ( last time was only 70 participants). If you also have free time, participate and compete against me (I hope for 100 competitiors). Contest has 6 problems and lasts 3 hours. Site also has some rating system...
For me this is new thing,I'd like to try new site and solve new problems.
More information:
what is the difficulty of gold contest compared to div 1 codeforces contests?
I hope most problems will turn out to be Div1 B, C, or D level, except for one or two easier problems.
Thanks for information! Can you tell me about testing system ( full feedback or nor ? ) and whether the problems are sorted by difficulty ?
The contest is full feedback. The score will be the maximum score of all submissions, but the tie-breaker for equal score is the most recent time you submit (so if you resubmit and get the same amount of points, you will gain more time penalty). Time penalty is sum of submission times of the counted submissions over all problems from beginning of registration.
All the problems are worth an equal number of points, and partial marks are available in the form of subtasks.
Problems in Bronze and Silver are sorted by difficulty. Problems in Gold are in random order.
Can we choose which solution to be official, that is if we resubmit and get the same amount of points, can we choose our official solution to be the one made first in order to have less time penalty?
No, unfortunately the contest system does not support this. An imperfect solution is that you can post a comment to remove your later submissions from the contest, and we will try to accommodate you.
For me this was interesting contest. I was solving 3 problems on competition.First problem was easy ( but at begining I think that we couldn't do it in O( n3 ). Last two problems was a little harder and I couldn't think something smart. I'd love to hear solutions.
Also I have problem with Pascal, I do 5th and 6th problem , for some points , in good complexity but I get TLE ( for example subtask in 6th problem with M<=10 I do in complexity 10*(n+q) and get TLE ).
How did you solve 1st :P we had to find a cycle . ( that was easy ) but cycle should make a square (that i had no clue)
You can ask me after the end about solution.
The mirror is still open for the next six hours. It might be better to discuss solutions after everyone has finished competing (especially since FatalEagle mentioned that this contest might impact ratings).
Sorry I don't see that...I'll edit my post.
Now that the onsite contest is over, I want to say a few words.
Firstly, I want to apologize to all the users that started at the very beginning and so were affected by strange test data in P2. I'm particularly sorry to Egor and zxqfl, because I answered their clarifications, and I answered them wrongly. Not just once, but twice! I wasted a lot of their time with that, so again, I'm sorry.
The updated test data for P2 also affected one onsite team which previously got 100, but it was unfair to decrease their score an hour after they received the AC verdict. Luckily, even if we chose the other way (rejudge without manually changing score), that team would still place first (due to time penalty).
Luckily, the bronze and silver contests, where the majority of onsite participants were, went much more smoothly.
I probably shouldn't try preparing (almost) entire problemsets two days before the contest without a tester anymore. In fact, I said the same thing several times before, but it always ends up happening again. So instead I hope I will improve at last-minute contest preparation. I hope everyone found the contest enjoyable, and short solution sketches for Gold will be posted on the site after the unofficial mirror ends.
UPD: Now that the online contest is also over, I want to add two more things. First, some of the time limits for Java were a bit tight, I only considered onsite competitors when making problems and most of them used C++. Also Java8 judge is slower than Java7 judges. Sorry to those affected. Also, my expected difficulties and predictions of problems were wildly incorrect. A few submissions that I looked at for P6 solved it by hacking the data (test cases were fairly weak).
problem: DMPG '15 G3 — Kinako Bread 2 has complexity N * log^3 N with 2d fenwick tree? if not can you explain how to get results in log N ?
I know an
O(N * log^2 N)
solution based on the centroid decomposition(it gets AC in practice mode, I didn't have enough time to implement it during the contest).The merge phase looks like this: let's take a look at two vertices from different subtrees. When do they form a valid pair? When
Lk <= sk1 + sk2 + addK <= Rk
andLc <= sc1 + sc2 + addC <= Rc
(sk
is the numbers ofK
's on the path from a vertex to the root of its subtree.addK
is0
or1
(it depends on the content of the root).sc
andaddC
are the same thing but forC
's).If we fix one point, we can rewrite these inequalities as
Lk - addK - sk1 <= x <= Rk - addK - sk1
(constraints forC
are handled similarly). It means that we just need to count the number of points in a rectangle. It is a standard problem with a well-knownO(N * log N)
solution which uses a sweep line and a binary index tree.How to deal with vertices from one subtree? We can just run the same algorithm for each subtree separately and subtract the result from the answer.
Now we know how to merge all subtrees in
O(N log N)
time, so the total time complexity isO(N * log^2 N)
.Yes, this is the official solution. My implementation can be found here: http://ideone.com/L50nyo.
Shouldn't line 96 take care of the RK == 0 and RC == 0 case?
For the input
It seems to return 2 instead of 0.
I've tried to solve last problem by using Mo's Algorithm. Its complexity was . I thought I could get 60 points, but I got 40 points. Is there anyone who got 60 with Mo's algorithm? Also, what's the 100 points solution?
Here is a very simple
O(N * sqrt(N))
solution(which obviously gets a full score):If
r - l + 1 < 3 * SQRT(N)
, we can simply iterate over the entire[l, r]
subarray.If the query range is longer, we know that any flavor that occurs at least
L / 3
times must occur at leastSQRT(N)
times in the entire array. But there are at mostSQRT(N)
such flavors! Thus, we can simply iterate over all "interesting" flavors(that it, those that occur at leastSQRT(N)
times) and check if any of them fits.Brilliant! Thanks for the answer :)
That's how I did it too. Here's an implementation: https://ideone.com/HyDo11