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!

Some useful links (more to be added):

- First round discussion.
- Official rankings.- Таблица реузльтатов от неутомимого snarknews с множеством разной дополнительной интересной информации.
- Rankings by snarknews with lots of extra interesting information.
- List of the contestants according to the great IOI database.
- IOI website
- Post by SeyedParsa about the Olympiad.
- Mirror contest hosted by Yandex.Contest.

When will they start? And when will mirror start?

They have started 8 minutes ago. Don't know much about the mirror, isn't it 1 hour after the competition start?

The mirror contest is now available at Yandex.

Early statements, please :D

Statements uploaded by jonathanirvings http://jonathanirvin.gs/files/ioi2017/day2/

Breathe deeply, be strong, wait for mirror, be strong...

Here you can see the problems and their translations.

Another ranklist here

Deleted

.

It was link to standings of onsite IOI... What did you expected, upvotes for weak "never gonna give you up"? :/

Ok good point

I_love_Margot_Robbie, sancho, m4ddie, Nurlykhan go++ :)

The scoring scheme for Prize is terrible.

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 :)

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.

Can we ask what was the answer?

Do you have any ideas about that problem?

Thanks to msg555, the farming edition is up and running again!

(warning: it has sound)

lol I quickly found out all other teams, but wondered which team is the hydralisk

copied from his source code

jerry's struggle for that 100 in The Big Prize tho lol

edit:yutaka1999! Go for the winner!

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?

I wondered if he would like to share how he accomplished such an impressive achievement.

"Hello sir, how to become red in one year? Looking forward to you answer, best wishes."

By the way, Swistakk, now you certainly don't want to take this bet.

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.

Actually Reyna became red in one year

Congratulations, nice double win!

Let's go to major international tournaments together next year and compete for the titles :)

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!

Thanks for info!

Now they're saying "by at least 15 minutes, maybe longer".

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.

rpeng just announced on the stream that 15 minutes more have been added.

Did they give any reasons for the extension?

He briefly mentioned that there was a large queue and that feedback took more than five minutes.

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..

According to the current state of the contest hall, contest is extended by 30 minutes (in total).

Are the contestants able to submit solutions in the extended time? (I hear Achilles chasing a turtle...)

What did you do to Iran's team LiTi? No gold?

Update : It's still changing. One gold by now.

No changing in the scoreboard

We have to wait untill the closing ceremony to find out the results ?

http://ioi2017.snarknews.info/index.cgi?data=2017/day1pre&class=ioi2017&year=2017

Yeah, I know, but for the most of scoreboard it's a good approximation.

If I am not mistaken, ioi never prolonged contest, especially cuz of queue and testing system. Do they have serious reason to do this?

Panic :D

Seems to be over now, judging by the stream.

Thanks god

I almost thought they are going to make day 3

The scoreboard hasn't changed yet.

Do we have to wait until the closing ceremony to see the results?

OK, so that will be some fair amount of work :P. I am really surprised by some similarity of this problem to ... some other problem :P (details in spoiler)

Simurgh solutionLet's start with solution that does <=m queries. It's obvious that if an edge is a bridge that it is a royal road. We will focus on taking an arbitrary spanning tree T and determining for every of its edges whether it's royal. In order to do this we will demand even more. For every vertex v we will fix one of edges that determines its low value (one we compute when determinining bridges etc.). Let's call set of such edges as L. We will determine which roads from L are royal as well, but just as an auxiliary result.

Let's look at two trees

T_{1}andT_{2}so thatT_{2}is obtained fromT_{1}by removing edgee_{1}and adding edgee_{2}. IfC(T_{2}) =C(T_{1}) + 1 (where C is shorthand for count_common_roads function) then we know thate_{2}is royal ande_{1}isn't. Similarly ifC(T_{2}) =C(T_{1}) - 1. Call it exchange lemma.Now let's look at some cycle in our graph. Let it consist of edges

e_{1}, ...,e_{k}. We can create a treeT_{i}that has all edges from this cycle excepte_{i}and all such trees has same set of roads except this cycle. From exchange lemma if it is the case that some of edges from this cycle are royal, but some aren't then we will easily determine for every edge whether it is royal or not. It can't be the case that all edges from cycle are royal, so otherwise no edges are royal, so we know everything as well.Let's return to our goal, determining which of edges from

TandLare royal. For start let's ask aboutC(T). For every edgeefromTthat is not bridge let's ask aboutC(T_{e}) that is created fromTby removingeand adding edge that determines low(v), wherevis its deeper (in spanning tree) vertex. Moreover for every edgeeinLask forC(T_{e}) that isTwith addedeand removed edge from spanning tree that is highest ofT's edges lying on a cycle formed inTwith addede.So we know

R(e_{1}) -R(e_{2}) for some pairs of edgese_{1}ande_{2}, whereR(e) = 1 iffeis royal or 0 otherwise. We can create a graphGwhose vertices are edges of original graph from eitherTorLand two vertices (corresponding to original edges) are connected with directed edge if we know difference ofRwhen applied on them. If we take a connected component in such graph and at least one of differences is nonzero we easily determineRvalues on all of such vertices/edges. We can note that if our original graph is biconnected (and has >2 vertices) then graphGis connected and since it contained cycle we know that if all differences are zero then no edges fromTorLare royal. That fact applied to all biconnected components of our original graph leads to algorithm of determining royality of all edges fromTandL. But we can forget aboutL, we will use justTfrom this point on.Now for every edge

enot fromTorLwe can create a treeT_{e}that has edgeeandn- 2 of edges fromTthat together witheform a tree. We can ask aboutC(T_{e}) and from exchange lemma we will determineR(e). This leads to a solution scoring 51 points (maybe there is simpler way of getting that many, but this solution can be further extended to get 100 pts)Now we can move on to solution using queries instead of

O(m). On beginning let's observe that if we have set of edgesFthat forms a forest we can know how many of its edges are royal by adding edges fromTas long as they do not form a cycle and asking about number of royal edges in resulting tree. Since we know which of edges fromTare royal we just subtract number of added royal edges fromTfrom the result ofCquery. However we will use this just forFsets that are stars.Let's fix a vertex

v, we will determine all edges incident tovthat are royal and are not fromT. If there arekof them we will use at most queries. We do this in almost the same way as in prize problem, similarity between these two problems is really big. LetE_{v}be set of edges not fromTthat are incident tov. We can learn what isC(E_{v}) (abuse of notation sinceE_{v}is not a tree, hope that it is clear). If it is zero then we conclude there are no interesting edges here. If it isk> 0 we then ask aboutC(H) whereHis a first half ofE_{v}. IfC(H) > 0 then we recursively find all royal edges inHand ifC(H) -k> 0 then we recursively find all royal edges in second half ofE_{v}. It's kinda like a binary search that tries to find multiple objects instead of just one. That results in queries that are needed to find all royal edges incident tovwhat gives queries in total. We are almost done, but this slightly exceeds query limit, because it is something like , because for edgeuvwe use queries when searching throughu's edges and queries when searching throughv's edges. To fix this, when we browsev's edges we not only discard ones that are fromTbut also ones that go to vertices with lower index. That concludes solution which uses at most queries and gives 100 pts.Could some provide some hints about Prize problem?

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?

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.

I've tried first min(n, 500) boxes at the beginning: 450

^{2}> 200 000, so we will find at least one least valuable box.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 (22

^{2})^{2}> 200000. That allows me to ask about only 23 boxes.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.

Remember that the grader is adaptive so it can give you 50 valuable boxes just to piss you off ;)

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.

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.

26^2 > 440

1 4 21 446 198917 requiers 472 and there can't be more (i believe simple cases will provide you with the proof)

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.

This solution with memorizing was enough for me to get 100 points.

to reduce queries from to , divide the array into blocks and then binary search just within each block.

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 sincex≤ 472. And then use a functionf(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 thanx, updatexby that value. After every query and every recursive call done inf, ifxis 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.Congrats to 高谷悠太（たかや ゆうた） who came first in both IOI2017 and IMO2017!

yutaka seems better for me :p

but I wonder what is inside the brackets ?

lol it's japanese

oh didn't know -.-

[deleted]

Would like to hear what contestants like matthew99 and reyna thought of the contest. I think everyone is surprised about their result.

sad as fuck. how else can i feel

Give them a break, man.

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

The second time extension was like 50 seconds before the extended end time... Please don't do that again...

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?

Definitely earlier, at least 15 minutes before 5 hours.

Actually what is the reason of the second extension?

https://en.wikipedia.org/wiki/1972_Olympic_Men%27s_Basketball_Final

Wow amazing grind Pedrohso ,from nothing to gold!

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

Italia again... called it.

???: Hi , so to me seems like a notorious coincidence.

What are the chances of 144.99 reaching bronze cutoff?

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

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.

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.

Bronze right now is at 135.76 points; do you think appeals would change it significantly?

Wow astonished at the result renewed. I would never believe 1, 4, 5-th place would be occupied by Japanese guys.

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?

Well, he is a tourist of last minute. He also raised score in last few seconds at some day of JOI Spring Camp :)

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 :)

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?

Ah, yes — he told me he found very small bug which he fixed within the last minute. Very impressive.

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.

for Books , does anyone have a testcase where the logic for

S= 0 fails withS> 0?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"

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.

To clarify, how will you handle the case where the permutation covers

sbutsis not a part of it, i.e.sis a fixed point?For example,

thanks , got my mistake.

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? :D

EDIT: I keep getting WA on testcase 5 :D Somehow testcase 4 works fine :s

My first solution outputs 4 instead of 6 for this case.

more strong casesanswer: 16

answer: 32

answer: 20

Can someone show an example code for the "Prize" task? I didn't understand how to interact with the system

90 pts clean code100 pts ugly codeCongrats reality on g̶e̶t̶t̶i̶n̶g̶ ̶a̶ ̶s̶i̶l̶v̶e̶r̶ ̶m̶e̶d̶a̶l̶ defeating Rudy69.

:C

It was obvious, actually.

UPDFull ResultHow 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.

I did the same fucking thing and didn't get time to do ~30 points subtasks for silver. :(

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. :(

Oh God, these stories are scarier than any creepypasta.

When looking on the submission for

by 9-th placed Lukas Michel, we can observe, that he first solved subtasks 1-3 and in the very last submissionSimurghonlysubtask 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?

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...

This has always been the case. For most problems and sets of subtasks, you can write a solution of the form

...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

differentspecial 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

almostgranted, 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 :)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.

Does anyone know why my solution fails in tests 65, 68-72, 74 on books?