### Noam527's blog

By Noam527, history, 20 months ago, ,

Hey!

I am not related to the organization of this competition, however there doesn't seem to be any blog post regarding it (and there's not much time left), which is unfortunate so that's why I'm writing this :).

Today (in approximately 4.5 hours, 14:00 UTC) starts this year's COI — Croatian Olympiad in Informatics. The contest is open and the registration page is here (while this page contains a redirect to the registration, along with their past problemsets).

The competition should be close to IOI style; It seems to contain ~4 problems and from what I understood, has a duration of 5 hours. A big difference is that there is no full feedback during the contest: every submission is only tested on the samples provided during the contest (I would expect them to change this format for COI but it doesn't seem to be the case).

Good luck! Let's discuss the problems and the solutions here after the contest ends :).

• +43

 » 20 months ago, # |   +3 I put all my time into B (after finishing A though it might be wrong/have corner cases, as I did not prove it)... so my score wouldn't be high but I had a lot of fun. Hopefully I'll get something high on B (hopefully there won't be bugs...).Regarding C and D, I'd like to know how people solved C (for 100 points). As for D, I still want to think about it.
•  » » 20 months ago, # ^ |   +3 What is your strategy to pick high points from B?
•  » » » 20 months ago, # ^ | ← Rev. 2 →   +5 I had many cases. I managed to convert some to others to shorten my work, but still there were many left. I believe my solution is optimal, because for all cases the polygon I build has 0 points inside (besides the case where a = b = 0, where I'm not sure if what I did was optimal but it seems so).I'll probably share it, later though.Edit: I got most of the tests right, on all others I recieved "Invalid number of segments of some type"... I guess I need to bugfix now :P
•  » » » » 20 months ago, # ^ |   +5 Seems you got 30) Can you please now eleborate your solution?
 » 20 months ago, # |   +3 How to solve paprike?
 » 20 months ago, # | ← Rev. 2 →   0 Deleted. I thought B was finding max area polygon. Stupid..
 » 20 months ago, # |   +11 Results are available!
 » 20 months ago, # |   -17 Can C be solved with antipodal points and segment tree?
•  » » 20 months ago, # ^ | ← Rev. 3 →   +29 UPD: Yes, it can. Just got AC. I forgot that there may exist colinear points so that I can't get AC during the contest.
 » 20 months ago, # |   +1 How to solve C,D?
 » 20 months ago, # |   +12 SpoilerA : DFS and greedy. For each subtree, calculate the minimum cut, and the cost going up toward the root after the cut. You can find it in bottom-up fashion, with sortingC : Think about a huge circle of radius 10^100, which have a center inside of polygon. It will be so big that the polygon will now look like a point. We will place a point in such circle (because why not, large distance is better). A segment will be lit when the point is in certain circular arc of a huge circle. This means, if we place a point in a certain circular arc, we get a reward — the length of segment. We should place a point, where gives maximum profit. Also, for each query, two segment disappears and one segments appears, which means we have only O(N+Q) events of reward modification. Maintaining the maximum reward point can be done by coordinate compression (on angles) + lazy segtree. D. We inductively maintain a partial order P. Suppose we have a partial order for numbers < i. When we add number i, we check whether there is an relation from j to i. This can be done by making queries of (numbers < i && !jPx) i (numbers < i && jPx) (numbers > i). Given partial order we can find a lexicographically minimum answer with greedy. The inputs are small so any poly algorithm will work.
•  » » 20 months ago, # ^ |   +3 Can you explain much about Coordinate Compression?
•  » » » 20 months ago, # ^ |   +5 Our circular arcs (let’s just say “queries” from here) have at most O(n+q) distinct endpoints — where the rewards decrease or increase. This means we don’t have to consider all real numbers but a query’s endpoints, or any point arbitrarily close to them. So if we consider all queries offline, we will use coordinate compression in those endpoints, which can be represented with vectors from origin — essentially a integer pair, that can be compared with angular sorting. In my code, I used some tricks to ease implementation. Code
•  » » 20 months ago, # ^ |   +5 What do you mean by "(numbers < i && !jPx) i (numbers < i && jPx) (numbers > i)" in problem D?
•  » » » 20 months ago, # ^ |   +3 I think it's better to attach my code doing that part : Spoilervector gph[MAXN]; int q[MAXN]; bool vis[MAXN]; void dfs(int x){ if(vis[x]) return; vis[x] = 1; for(auto &i : gph[x]){ dfs(i); } } bool verify(int prv, int cur){ for(int i=0; i l, r; for(int i=1; i cur) q[i] = p[i]; } printf("query "); for(int i=1; i<=n; i++) printf("%d ", q[i]); puts(""); fflush(stdout); int x; cin >> x; return !x; } 
 » 20 months ago, # |   0 You can submit all problems here: https://oj.uz/problems/source/311
•  » » 20 months ago, # ^ | ← Rev. 4 →   +5 fixed
•  » » 20 months ago, # ^ |   0 How can I deal with the error 'The response parameter is missing' when I'm registering. Thanks.
•  » » » 20 months ago, # ^ |   0 It seems it is because we use reCAPTCHA for registering :( I cannot find a good way to avoid it.
 » 20 months ago, # |   +5 Problem B (Pick) Super ad-hoc problem. Many cases have a polygon that does not have any inner points. Find a base shape type 1~4. Grow to the right using a. Grow to the up using b, c, and d. Type 0: a, b, c, d = 0, 0, 2r, 2s. c and d are positive. Corner case that is given sample input 2.Type 1: a, b, c, d = 2p, 2q, 2r, 2s. a and b are positive.Type 2: a, b, c, d = 2p, 2q, 2r, 2s. a and c are positive.Type 3: a, b, c, d = 2p, 2q, 2r + 1, 2s + 1. a, c, and d must be positive.Type 4: a, b, c, d = 2p + 1, 2q + 1, 2r + 1, 2s.Otherwise, swap(c, d). It is mirrored problem with a line x = 0. More otherwise, swap(a, b). It is mirrored with a line y = x. I think there is no polygon for remaining cases, but I don’t have proof.