### Zlobober's blog

By Zlobober, 12 months ago, translation, ,

Hi everybody,

Less than in 30 minutes there will start a second round of IOI 2017. Yesterday all the students visited the sixth talles tower in the world named Milad Tower.

We wish all the contestants the good luck!

•
• +152
•

 » 12 months ago, # |   +20 When will they start? And when will mirror start?
•  » » 12 months ago, # ^ | ← Rev. 4 →   +13 They have started 8 minutes ago. Don't know much about the mirror, isn't it 1 hour after the competition start?
•  » » 12 months ago, # ^ |   0 The mirror contest is now available at Yandex.
 » 12 months ago, # |   0 Early statements, please :D
 » 12 months ago, # |   +26 Statements uploaded by jonathanirvings http://jonathanirvin.gs/files/ioi2017/day2/
•  » » 12 months ago, # ^ |   +124 Breathe deeply, be strong, wait for mirror, be strong...
 » 12 months ago, # |   +7 Here you can see the problems and their translations.
 » 12 months ago, # |   -6 Another ranklist here
 » 12 months ago, # | ← Rev. 3 →   -41 Deleted
•  » » 12 months ago, # ^ | ← Rev. 3 →   -25 .
•  » » » 12 months ago, # ^ |   +16 It was link to standings of onsite IOI... What did you expected, upvotes for weak "never gonna give you up"? :/
•  » » » » 12 months ago, # ^ |   -18 Ok good point
 » 12 months ago, # |   +29
 » 12 months ago, # |   +28 The scoring scheme for Prize is terrible.
•  » » 12 months ago, # ^ |   +29 Yesterday I also realized that the distribution of this problem is not good (only 20, 90-100 assuming most people got subtask 1, which is relatively easy). During the yesterday's GA meeting, I raised a minor objection about this. However, the answer from the ISC is satisfying (believe me), so now I am agree with the scoring :)
•  » » » 12 months ago, # ^ |   +31 My opinion is that the curve should be similar regardless of difficulty. Now contestants who happens to suddenly don't know how to do / have bugs are severely punished. Now it seems that the whole IOI (bronze) will be decided by this 70 points.Just my own opinion though.
•  » » » 12 months ago, # ^ |   +43 Can we ask what was the answer?
•  » » 12 months ago, # ^ |   -7 Do you have any ideas about that problem?
 » 12 months ago, # | ← Rev. 2 →   +74 Thanks to msg555, the farming edition is up and running again!(warning: it has sound)
•  » » 12 months ago, # ^ |   +10 lol I quickly found out all other teams, but wondered which team is the hydralisk
•  » » » 12 months ago, # ^ |   +16 copied from his source code var team_image_map = { "KOR": "hydralisk.png", "CAN": "moose.png", "AUS": "roo.png", "NZL": "kiwi.png", "GBR": "guard.png", "RUS": "hedge.png" }; 
 » 12 months ago, # | ← Rev. 3 →   +15 jerry's struggle for that 100 in The Big Prize tho loledit:
 » 12 months ago, # |   +177 yutaka1999! Go for the winner!
•  » » 12 months ago, # ^ |   +265 MASSIVE CONGRATULATIONS yutaka1999!! Winning both IMO and IOI , impressive... Is he second person in history to achieve this, after Reid Barton as far as I remember?
•  » » » 12 months ago, # ^ |   +43 I wondered if he would like to share how he accomplished such an impressive achievement.
•  » » » » 12 months ago, # ^ |   +108 "Hello sir, how to become red in one year? Looking forward to you answer, best wishes."
•  » » » » » 12 months ago, # ^ |   +99 By the way, Swistakk, now you certainly don't want to take this bet.
•  » » » » » » 12 months ago, # ^ |   +82 I still do. When writing that I also took into account that you will get familiar with IOI format during participating in 100 IOIs :D.
•  » » » » » 12 months ago, # ^ |   +9 Actually Reyna became red in one year
•  » » 12 months ago, # ^ |   +108 Congratulations, nice double win!Let's go to major international tournaments together next year and compete for the titles :)
 » 12 months ago, # |   +39 They just announced on the stream that the contest has been extended by 15 minutes because of technical issues, so there's 23 minutes to go!
•  » » 12 months ago, # ^ |   0 Thanks for info!
•  » » 12 months ago, # ^ |   +5 Now they're saying "by at least 15 minutes, maybe longer".
•  » » » 12 months ago, # ^ |   +10 To summarize what was told on the stream, the judging system still doesn't seem to work well, there's a big queue and it's not clear when the contest will end. So far it seems that it has been extended by 15 more minutes, for total duration of 5:30.
 » 12 months ago, # |   +3 rpeng just announced on the stream that 15 minutes more have been added.
•  » » 12 months ago, # ^ |   0 Did they give any reasons for the extension?
•  » » » 12 months ago, # ^ |   0 He briefly mentioned that there was a large queue and that feedback took more than five minutes.
 » 12 months ago, # |   +8 Is time on submission indicate the "time of judge" rather than "time of submit?"And I'm nearly getting heart attack for every time extend..
 » 12 months ago, # | ← Rev. 2 →   0 According to the current state of the contest hall, contest is extended by 30 minutes (in total).
•  » » 12 months ago, # ^ |   +15 Are the contestants able to submit solutions in the extended time? (I hear Achilles chasing a turtle...)
 » 12 months ago, # | ← Rev. 2 →   +24 What did you do to Iran's team LiTi? No gold?Update : It's still changing. One gold by now.
 » 12 months ago, # |   +3 No changing in the scoreboard We have to wait untill the closing ceremony to find out the results ?
•  » » 12 months ago, # ^ |   -15
•  » » » 12 months ago, # ^ |   +20 Last change(s): (05:03)
•  » » » » 12 months ago, # ^ |   -15 Yeah, I know, but for the most of scoreboard it's a good approximation.
 » 12 months ago, # |   0 If I am not mistaken, ioi never prolonged contest, especially cuz of queue and testing system. Do they have serious reason to do this?
•  » » 12 months ago, # ^ |   0 Panic :D
 » 12 months ago, # |   +18 Seems to be over now, judging by the stream.
•  » » 12 months ago, # ^ |   +10 Thanks god I almost thought they are going to make day 3
•  » » 12 months ago, # ^ |   0 The scoreboard hasn't changed yet.Do we have to wait until the closing ceremony to see the results?
 » 12 months ago, # |   0 Could some provide some hints about Prize problem?
•  » » 12 months ago, # ^ | ← Rev. 2 →   0 1) There's a lot of least valuable boxes and just a few of more valuable ones 2) Try determining at least one 3) If we have two of them, how can we tell whether there is more valuable one between them? How to use this fact to look for more valuable boxes?
•  » » » 12 months ago, # ^ |   0 Do you have a deterministic way of finding the least valuable box? After ~50 random shots there's almost no way you don't hit at least one, but it is still possible.
•  » » » » 12 months ago, # ^ |   0 I've tried first min(n, 500) boxes at the beginning: 4502 > 200 000, so we will find at least one least valuable box.
•  » » » » » 12 months ago, # ^ |   +8 In order to make my number of queries lower I noted that if sum of two values returned by checker is at least 22 then it is least valuable, because (222)2 > 200000. That allows me to ask about only 23 boxes.
•  » » » » 12 months ago, # ^ |   0 Yes, I have. Note that checker is adaptive, so in fact it is possible that if checker is evil you will not find any even after 50 shots.
•  » » » » 12 months ago, # ^ |   0 In the first 500 there must be a least valuable box. If there were 500 other boxes, then from the least but one valuable box there would be like 470, and 470^2 > 2*10^5.
•  » » » » » 12 months ago, # ^ | ← Rev. 2 →   0 Whoops I made this error. At my initial code I checked only 450 boxes to find the minimal, as 450^2 > 2*10^5, but I forgot that this is not necessarily the only layer. 1, 2, 5, 26, 440, 199526 requires 473.
•  » » » » » » 12 months ago, # ^ |   0 26^2 > 4401 4 21 446 198917 requiers 472 and there can't be more (i believe simple cases will provide you with the proof)
•  » » » » 12 months ago, # ^ |   0 Remember that the grader is adaptive so it can give you 50 valuable boxes just to piss you off ;)
•  » » 12 months ago, # ^ |   0 Simple solution for 90 points. It's easy to see that at most 500 items are non-lollipops. So query the first min(n, 500) items to find at least one lollipop (this is the one with largest answer sum). Then to locate all the non-lollipop boxes we could binary search prefixes; it takes at most 500*log_2(200K) ~ 8.5K. (you could save a bit, not sure how many by memoizing queries)Afterwards just search each of the non-lollipop one by one for the diamond (there's at most 500 of them); the diamond is the one with both 0 result.
•  » » » 12 months ago, # ^ |   0 This solution with memorizing was enough for me to get 100 points.
•  » » 12 months ago, # ^ |   +13 to reduce queries from to , divide the array into blocks and then binary search just within each block.
•  » » 12 months ago, # ^ | ← Rev. 3 →   0 My approach for 9X marksLet's define the boxes which are not the cheapest as good boxes. At first, use 472 queries to get the total number of good boxes, x. 472 are enough since x ≤ 472. And then use a function f(left, right, number of good boxes with indices  < left, number of good boxes with indices  > right) to locate and search for the good boxes by "binary search with multiple targets" (maybe it has a specific name?). My approach for 100 marksAssume the total number of good boxes, x, is 0. Then directly use the function mentioned above without the initial 472 queries. If a query gives a sum larger than x, update x by that value. After every query and every recursive call done in f, if x is updated, do everything again inside that call including the recursive calls. Make sure that the answers from the queries before are stored to prevent multiple queries for the same box.
 » 12 months ago, # |   +63 Congrats to 高谷悠太（たかや ゆうた） who came first in both IOI2017 and IMO2017!
•  » » 12 months ago, # ^ |   +10 yutaka seems better for me :p but I wonder what is inside the brackets ?
•  » » » 12 months ago, # ^ |   +10 lol it's japanese
•  » » » » 12 months ago, # ^ |   +18 oh didn't know -.-
•  » » 12 months ago, # ^ | ← Rev. 2 →   +2 [deleted]
 » 12 months ago, # |   +91 Would like to hear what contestants like matthew99 and reyna thought of the contest. I think everyone is surprised about their result.
•  » » 12 months ago, # ^ |   +362 sad as fuck. how else can i feel
•  » » 12 months ago, # ^ |   +38 Give them a break, man.
•  » » 12 months ago, # ^ |   +129 Hi, i was kinda frustrated, now i'm much better (i gotta thank everyone for their consolations, my family, friends, people of cf and a lot more, thank you everyone) About the problems, i liked them, but they were too hard for me to solve, there were a lot of strong participants that managed to solve them, congrats (especially yutaka1999 for that impressive win, both on IMO and IOI) I enjoyed this wonderful event, despite how i performed, hope everyone else enjoys it aswell
 » 12 months ago, # |   0 The second time extension was like 50 seconds before the extended end time... Please don't do that again...
•  » » 12 months ago, # ^ |   0 Our contestants told that the first time extension was around 15 seconds before the end of the 5 hours. Did you hear that announcement earlier?
•  » » » 12 months ago, # ^ |   0 Definitely earlier, at least 15 minutes before 5 hours.
•  » » 12 months ago, # ^ |   0 Actually what is the reason of the second extension?
•  » » 12 months ago, # ^ |   0
 » 12 months ago, # |   0 Wow amazing grind Pedrohso ,from nothing to gold!
•  » » 12 months ago, # ^ | ← Rev. 2 →   +21 Pedrohso is an incredibly talented guy. I feel very proud by having taught him a few classes a while ago, and I'm happy he could overcome his past coding limitations and was able to fully showcase his problem solving skills. We Brazilians are all very excited about this result, which hopefully will get official soon! :D
 » 12 months ago, # |   -22 Italia again... called it.
•  » » 12 months ago, # ^ |   -37 ???: Hi , so to me seems like a notorious coincidence.
 » 12 months ago, # |   0 What are the chances of 144.99 reaching bronze cutoff?
•  » » 12 months ago, # ^ |   +1 Decent. Usually cutoffs are 1:2:3:6, there are more than 300 participants, and 150th has something like 135 as far as I remember
•  » » 12 months ago, # ^ | ← Rev. 2 →   0 I believe it should be bronze. Half of the participants get medals and 144.99 seems to be in the first half.P.S.Though, it seems like the current standings are not the final standings for some odd reason.
•  » » » 12 months ago, # ^ |   +38 At this point, I haven't even got the confirmation that day 1 results are final, and I have suspicions that they might not be, which is why I did not publish even preliminary results to the statistics.
•  » » » 12 months ago, # ^ |   0 Bronze right now is at 135.76 points; do you think appeals would change it significantly?
 » 12 months ago, # |   +111 Wow astonished at the result renewed. I would never believe 1, 4, 5-th place would be occupied by Japanese guys.
 » 12 months ago, # | ← Rev. 3 →   +124 5:29:57....Uhh, maroon_kuri, how do you submit twice in the last minute of the contest (when the judge is too slow to get feedback) and manage to have exactly one of the solutions work?
•  » » 12 months ago, # ^ |   +3 Well, he is a tourist of last minute. He also raised score in last few seconds at some day of JOI Spring Camp :)
•  » » 12 months ago, # ^ |   +39 You don't have to wait for the judge to finish to resubmit. Also, in the last 15 minutes, submissions have no minimum interval. So submitting twice in the last minute is very normal...I was lucky enough to sit next to him this year. He told me after the contest that he submitted in the last few seconds for Q5. He was very happy to find out 3 hours later during analysis time that he received 100 points :)
•  » » » 12 months ago, # ^ |   +10 Sure, submitting twice is normal. I want to know if he was making random changes and submitting or if he miraculously found a bug in the last few seconds, debugged instantly and squeezed in a correct submission three seconds before the contest ended?
•  » » » » 12 months ago, # ^ |   +21 Ah, yes — he told me he found very small bug which he fixed within the last minute. Very impressive.
•  » » 12 months ago, # ^ |   +10 He said that in last minute he found some optimization and got 100. He didn't know that result until the analysis, since the scoreboard was broken.
 » 12 months ago, # |   +14 for Books , does anyone have a testcase where the logic for S = 0 fails with S > 0?
•  » » 12 months ago, # ^ | ← Rev. 2 →   +20 Lol. Care to elaborate what you mean, just a suggestion :)? There are a lot of ways you can think about this problem and there are a lot things you can simply don't care about if S=0. Don't expect us to know what you mean by "logic for S=0"
•  » » » 12 months ago, # ^ |   +1 first of all i add count of (j <= i && p[j] > i) + (j > i && p[j] <= i) to the answer for all 0 <= i < n-1 (just the number of crossing from i to i + 1 and i + 1 to i)Then if the permutation isn't connected like this  . . _______ . s . . __________ . . .  I also add those "Gaps" in the middle to the answer , however this seems to fail for s > 0.
•  » » » » 12 months ago, # ^ | ← Rev. 2 →   +20 To clarify, how will you handle the case where the permutation covers s but s is not a part of it, i.e. s is a fixed point?For example, 3 1 2 1 0 
•  » » » » » 12 months ago, # ^ |   0 thanks , got my mistake.
•  » » » » » » 12 months ago, # ^ | ← Rev. 4 →   0 How to make it from 70 points to 100 points?EDIT:When S=0 I know a O(n) solution what merges cycles. Otherwise, I can't imagine how to count the amount of walking from starting point to largest cycle covering it. I have a dijkstra solution what works in O(n^2) because I need to check if i can travel from one cycle to another...EDIT: Maybe we need to do the dijkstra from the other side? :DEDIT: I keep getting WA on testcase 5 :D Somehow testcase 4 works fine :s
•  » » 12 months ago, # ^ | ← Rev. 2 →   +21 My first solution outputs 4 instead of 6 for this case. 3 1 2 1 0  more strong cases5 2 4 3 2 1 0 answer: 16 10 5 8 3 6 1 4 5 2 7 0 9 answer: 32 9 3 1 0 4 3 2 8 7 6 5 answer: 20
 » 12 months ago, # |   0 Can someone show an example code for the "Prize" task? I didn't understand how to interact with the system
•  » » 12 months ago, # ^ |   +5 90 pts clean code#include "prize.h" #include "bits/stdc++.h" using namespace std; int find_best(int n){ int mx = 0; for(int i = 0 ; i < 500 ; ++i){ vector < int > res = ask(i); if(res[0] + res[1] == 0){ return i; } mx = max(mx , res[0] + res[1]); } int i = 500; while(i < n){ vector < int > res = ask(i); if(res[0] + res[1] == 0){ return i; } if(res[0] + res[1] == mx){ int l = i + 1; int r = n - 1; while(l < r){ int mid = l + r >> 1; vector < int > tmp = ask(mid); if(tmp[0] + tmp[1] == 0){ return mid; } if(tmp[0] + tmp[1] < mx){ r = mid; } else{ if(res[1] - tmp[1] > 0){ r = mid - 1; } else{ l = mid + 1; } } } res = ask(l); if(res[0] + res[1] == 0){ return l; } i = l + 1; } else{ ++i; } } }  100 pts ugly code#include "prize.h" #include "bits/stdc++.h" using namespace std; bool done[200001]; vector < int > mem[200001]; vector < int > myask(int idx){ if(done[idx]){ return mem[idx]; } done[idx] = 1; return mem[idx] = ask(idx); } int solve(int rsmall , int ql , int qr , int mx){ if(ql > qr){ return -1; } int l = ql; int r = qr; while(l < r){ int mid = l + r >> 1; vector < int > tmp = myask(mid); if(tmp[0] + tmp[1] == 0){ return mid; } if(tmp[0] + tmp[1] == mx){ if(rsmall - tmp[1]){ r = mid - 1; } else{ l = mid + 1; } } else{ r = mid; } } while(l <= qr){ vector < int > tmp = myask(l); if(tmp[0] + tmp[1] == 0){ return l; } if(tmp[0] + tmp[1] == mx){ break; } ++l; } if(l == qr + 1){ return -1; } if(mem[l][1] - mem[qr + 1][1]){ return solve(myask(l)[1] , l + 1 , qr , mx); } return -1; } int find_best(int n){ int mx = 0; memset(done , 0 , sizeof(done)); int groups = 460; int small = n / 460; int large = small + 1; int cur = 0; vector < int > ids; ids.clear(); for(int i = 0 ; i < groups ; ++i){ vector < int > res = myask(cur); mx = max(mx , res[0] + res[1]); if(res[0] + res[1] == 0){ return cur; } ids.push_back(cur); if(i < (n % 460)){ cur += large; } else{ cur += small; } } done[n] = 1; mem[n] = {mx , 0}; ids.push_back(n); for(int i = 0 ; i + 1 < ids.size() ; ++i){ int x = ids[i]; int y = ids[i + 1]; int res = -1; if(mem[x][0] + mem[x][1] == mx && mem[y][0] + mem[y][1] == mx){ if(mem[x][1] - mem[y][1]){ res = solve(mem[x][1] , x + 1 , y - 1 , mx); } else{ res = -1; } } else if(mem[x][0] + mem[x][1] == mx && mem[y][0] + mem[y][1] < mx){ while(y >= x){ vector < int > tmp = myask(y); if(tmp[0] + tmp[1] == 0){ return y; } if(tmp[0] + tmp[1] == mx){ break; } --y; } if(y == x - 1){ res = -1; } else{ if(mem[x][1] - mem[y][1]){ res = solve(mem[x][1] , x + 1 , y - 1 , mx); } else{ res = -1; } } } else{ while(x <= y){ vector < int > tmp = myask(x); if(tmp[0] + tmp[1] == 0){ return x; } if(tmp[0] + tmp[1] == mx){ break; } ++x; } if(x == y + 1){ res = -1; } else{ if(mem[y][0] + mem[y][1] == mx){ if(mem[x][1] - mem[y][1]){ res = solve(mem[x][1] , x + 1 , y - 1 , mx); } else{ res = -1; } } else{ while(y >= x){ vector < int > tmp = myask(y); if(tmp[0] + tmp[1] == 0){ return y; } if(tmp[0] + tmp[1] == mx){ break; } --y; } if(y == x - 1){ res = -1; } else{ if(mem[x][1] - mem[y][1]){ res = solve(mem[x][1] , x + 1 , y - 1 , mx); } else{ res = -1; } } } } } if(res != -1){ return res; } } } 
 » 12 months ago, # |   +38 Congrats reality on g̶e̶t̶t̶i̶n̶g̶ ̶a̶ ̶s̶i̶l̶v̶e̶r̶ ̶m̶e̶d̶a̶l̶ defeating Rudy69.
•  » » 12 months ago, # ^ |   +14 :C
•  » » 12 months ago, # ^ |   -54 It was obvious, actually.
 » 12 months ago, # | ← Rev. 2 →   -6 UPD Full Result
 » 12 months ago, # |   +32 How to lost your medal: Solve problem Prize under the impression that the checker is not adaptive, random 5 times instead of 500 times, spent 3 hours trying to optimize the binary search part without realizing that the checker is adaptive. Profit.
•  » » 12 months ago, # ^ | ← Rev. 3 →   -8 I did the same fucking thing and didn't get time to do ~30 points subtasks for silver. :(
•  » » » 12 months ago, # ^ |   +6
•  » » 12 months ago, # ^ |   0 Here is another example. I had Prize coded hour and a half in the contest, and it was correct with one tiny error: my bs was while l < r instead of l <= r, and I spent 3,5 next hours debugging it. I found my error literally minute until the end of the contest, fixed it, submitted, and then I realised I have commented a part of my code, for some kind of debugging. I deleted the comment, alt tabbed to the cms, but it was too late. In the analysis, that solution was accepted, without any changes. :(
•  » » » 12 months ago, # ^ |   +18 Oh God, these stories are scarier than any creepypasta.
 » 12 months ago, # |   -30 When looking on the submission for Simurgh by 9-th placed Lukas Michel, we can observe, that he first solved subtasks 1-3 and in the very last submission only subtask 4. (Probably some other such submissions can be found)Sure enough, in the rules we can read The score for each task will be sum of scores for its subtasks.What is the reasoning behind such scoring? Sure, it benefits the participants. But, essentially, participants might produce multiple partial solutions, instead of one that solves all subtasks. What are your thoughts, community?
•  » » 12 months ago, # ^ | ← Rev. 2 →   +10 It saves you the time and trouble of figuring out what subtask it is in your code. That's not what is being tested in IOI.Also, this is the same rule as last year...
•  » » 12 months ago, # ^ |   +33 But, essentially, participants might produce multiple partial solutions, instead of one that solves all subtasks. This has always been the case. For most problems and sets of subtasks, you can write a solution of the form if input_looks_like_subtask_1(): return brute_force() elif input_looks_like_subtask_2(): return solve_special_case() else: solution_1 = apply_heuristic_that_doesnt_always_work() solution_2 = apply_another_heuristic() return whichever_looks_more_reasonable(solution_1, solution_2) ...and this is indeed what participants did, and indeed more or less what the jury expected them to do.It's totally okay for participants to write partial solutions — indeed that is exactly what the entire concept of subtasks is for. Often it makes no sense to try to write a single solution that solves multiple subtasks: a reasonable IOI participant who cannot solve some problem completely might be able to solve subtask 1 with a bruteforce, and subtasks 2 and 3 might happen to be different special cases that can each be solved with a different special case solution. Requiring this participant to combine all three in a single file is just a waste of their time.Thus the introduction of the "sum of scores of subtasks" rule doesn't really change anything about the spirit of the competition, but it does fix some awkward things that might happen without it, especially when feedback is broken (and I remember more recent IOIs where feedback was broken at some point than IOIs where it never was). Here's an anecdote that hits close to home: our own OVR in 2012 submitted a solution to some problem that solved subtasks A, B, C. Then feedback was broken (and never got fixed before the end of the contest), and OVR submitted another solution, which happened to solve A, B, D, but broke on C for some reason. Because of the broken feedback, he never learned about this until after the end of the context. (score(ABCD) — max(score(ABC), score(ABD))) would've been enough points to move him from bronze to silver, and the team wrote an appeal arguing that, if feedback was working as intended, he'd have noticed this and just submitted a "merged" solution that invokes his old one when ran on tests from subtask C. The appeal was almost granted, until someone from the jury noticed that the second submission was made less than a minute before the end of the competition, which meant it was quite unlikely he'd have managed to do the merging in time, so the appear was eventually denied. Had the new rule been in place back in 2012, Latvia would've had one more silver medal :)
 » 12 months ago, # |   +40 IOI 2017 Preliminary Results. These are not the final results until GA approves them and as such may change.After discussion within the IC, the rank of the offsite contestant is defined as the highest rank amongst all onsite contestants with the same or smaller score.
 » 12 months ago, # |   0 Does anyone know why my solution fails in tests 65, 68-72, 74 on books?