### fcspartakm's blog

By fcspartakm, history, 3 years ago, translation, ,

Hello, Codeforces!

I'd like to invite you to Codeforces Round #386 (Div. 2). It'll be held on Sunday, December 18 at 13:35 MSK and as usual Div. 1 participants can join out of competition. Note that round starts in the unusual time!

This round is held on the tasks of the municipal stage All-Russian Olympiad of Informatics 2016/2017 year in city Saratov. They were prepared by Olympiad center of programmers of Saratov SU.

Great thanks to Nikolay Kalinin (KAN) for helping me preparing the contest, to Tatiana Semenova (Tatiana_S) for translating the statements into English, to Mike Mirzayanov (MikeMirzayanov) for the great Codeforces and Polygon platform and to Vladimir Petrov (P1kachu), Alexey Ripinen (Perforator), Mikhail Levshunov (Levshunovma), Mikhail Piklyaev (PikMike), Aleksey Slutskiy (ferc), Ivan Androsov (BledDest), Oleg Smirnov (Oleg_Smirnov) and Roman Kireev (RoKi) for writing solutions and editorials.

It will be a little unusual round — you will be given seven problems and two and half hours to solve them. The scoring distribution will be 500-1000-1500-2000-2500-3000-3000. Good luck everyone!

UPD Editorial

UPD2 Congratulations to the winners!

• +179

 » 3 years ago, # |   -35 Time of contest is clashing with https://atcoder.jp/. Please reschedule..
•  » » 3 years ago, # ^ |   +19 If you want atcoder to reschedule why you posting it here? :)
 » 3 years ago, # |   +26 Wow, the first time I see the score distribution early like this. Hope this with be a good contest.
•  » » 3 years ago, # ^ |   +19 Wow, the first time I see blog about the contest late like this.
 » 3 years ago, # |   0 Sunday**
 » 3 years ago, # |   +13 Hope the translation will be good!
 » 3 years ago, # | ← Rev. 2 →   +2 Excited! My color will be changing today.
•  » » 3 years ago, # ^ |   0 Mine will too! (I hope not though)
•  » » 3 years ago, # ^ |   0 I hope you will
•  » » 3 years ago, # ^ |   +7 I am sorry for you bro :(
•  » » » 3 years ago, # ^ |   +1 Yes, Maybe tomorrow!
•  » » 3 years ago, # ^ |   0 Be afraid of your desires. God of CF likes to joke if desire inexact. Everything turned out as you wanted? )
•  » » » 3 years ago, # ^ |   0 Maybe you're right.
 » 3 years ago, # |   +9 Wow, seven problems！
 » 3 years ago, # |   +3 Hope to see some data structures
•  » » 3 years ago, # ^ |   0 haha not as you wish :)
 » 3 years ago, # |   +2 Why so strange hours? And, as someone mentioned earlier, clashes with atcoder :c.
 » 3 years ago, # |   +20 7 problems?!! Couldn't there be a division 1instead? :3
•  » » 3 years ago, # ^ |   +9 Maybe it's too easy for div1 users.
•  » » » 3 years ago, # ^ |   0 Then a combined round could do the trick ..
 » 3 years ago, # |   +22 Mikhail Piklyaev PikMike 's graph is so awesome :O
•  » » 3 years ago, # ^ |   +1 seriously awesome and motivating graph :)
•  » » 3 years ago, # ^ |   +1 Hard work pays off,sooner or later.
•  » » 3 years ago, # ^ |   +1 Looks like PikMike have had the experience of all the ranks. From falling to grey and then rising again. Really motivating.
•  » » » 3 years ago, # ^ |   +19 If only ranks up to candidate master were all of them :( It's still a really long way to grandmaster.
 » 3 years ago, # |   0 Luckily I didn't fall to div2 today, so I can just solve some problems and then participate ARC066 :D
 » 3 years ago, # |   0 Hope that Tatiana does good job or we will have problems as #385's Div2B.
 » 3 years ago, # |   +5 I hope I can understand the statement:D
 » 3 years ago, # |   -11 I hope no one here asking "that" usual question..
 » 3 years ago, # |   -23 Is it rated?
•  » » 3 years ago, # ^ |   -9 Of course :) . Codeforce round is always rated ,without having any server/system failure.
•  » » 3 years ago, # ^ |   -6 Why Not ?
•  » » » 3 years ago, # ^ |   0 Because the round is based on the tasks of an Olympiad. So, unless the round is a mirror of the same contest, it should be unrated.
•  » » » » 3 years ago, # ^ |   0 Do you have the questions ? LOL
•  » » » » » 3 years ago, # ^ |   0 I don't, but someone else might have. Don't you think that'd be unfair?
•  » » » » » » 3 years ago, # ^ |   0 True that !
•  » » 3 years ago, # ^ |   0 Just right after I said it. How irony...
•  » » » 3 years ago, # ^ |   0 Was supposed to be a reply on your comment only. :p
 » 3 years ago, # |   +2 Very Unusual time :(
 » 3 years ago, # |   +3 Wow, Seven problems. Hope it will be an exciting contest and my color will change(from green to grey or cyan).
 » 3 years ago, # |   +1 I am confused! Is it rated or not?
•  » » 3 years ago, # ^ |   +4 Regular round always rated.
•  » » » 3 years ago, # ^ |   +4 see the.......... usual Div. 1 participants can join out of competition. That means it will be rated on.y for Div. 2
 » 3 years ago, # |   0 Can the answer in Div2C only be integer?
•  » » 3 years ago, # ^ |   0 yes!
 » 3 years ago, # |   +1 Hacking didn't work for me this contest, I kept getting "Submit already challenged", and hack would not go through. :(Also for A somehow I guess I double clicked submission button and so it submitted same code twice, with the first one counting for the resubmit penalty, does this always happen? Typically I think it prevents from submitting same code twice, but sometimes it allows?
•  » » 3 years ago, # ^ |   0 Seriously though does anybody know what it means when "Submit already challenged", but it has clearly not been challenged by anybody else.I was trying to hack skorpioas the whole time and it would not let me :( I tried both Chrome and Safari :(
 » 3 years ago, # | ← Rev. 2 →   +5 what could be the test 9 on problem D?
 » 3 years ago, # |   0 How to solve E? It was a pretty interesting one for me.
 » 3 years ago, # |   +3 Why there are some Experts participating as out of competition?
•  » » 3 years ago, # ^ |   0 Probably because they missed the registration, which ended 5 minutes before start of contest
•  » » » 3 years ago, # ^ |   0 dude I registered yesterday ...
•  » » » 3 years ago, # ^ | ← Rev. 2 →   0 Add to that my submission for A was at min 3 which means I didn't register with extra registration
 » 3 years ago, # |   0 I tried to hack problem C with the following input 5 4 0 1 2 5 -1And it says Invalid input with the following message = "Validator 'val.exe' returns exit code 3 [FAIL Integer parameter [name=p] equals to 5, violates the range 1, 4]"Isn't this input supposed to be valid? Does this mean the train can only go up until point s-1?
•  » » 3 years ago, # ^ |   +1 train can go uptil 0 and s But the input constraints say current position is from 1 to s-1 So input position cannot be s
•  » » » 3 years ago, # ^ |   0 endl's between numbers
•  » » 3 years ago, # ^ | ← Rev. 6 →   0 I was facing the same problem until I put endlines as they have done in the input. Also your constraints are wrong.
•  » » 3 years ago, # ^ |   +1 It was mentioned in the constraints that 1<=p<=s-1. Although the train can still go to point 0 and s, you cannot have those values as your initial position.
•  » » 3 years ago, # ^ |   0 Oh right, I didn't see the constraint. Thanks everyone for clarifying
 » 3 years ago, # |   -6 Editorials?
 » 3 years ago, # |   +21 Task were much more tehnical than hard...I was so near to solve G :(
 » 3 years ago, # |   0 Why this outputs are wrong for E problem ?INPUT 6 2 5 6 7 9 4 5 OUTPUT 1 5 6 7 9 4 1INPUT2 8 6 7 7 7 7 8 8 8 8 OUTPUT2 6 7 3 1 2 8 4 5 6
•  » » 3 years ago, # ^ |   +1 there are 4 odds (5, 7, 9, 1) but only 2 evens(6, 4). it seems that it's valid.
•  » » 3 years ago, # ^ |   +2 Number of odd number cards should equal to number of even number cards
•  » » 3 years ago, # ^ |   0 thanks... I missed this condition :/
 » 3 years ago, # |   0 Why I have to choose task number every time when I submit? Because of that I sent my solution to wrong problem. So sad :(
•  » » 3 years ago, # ^ |   0 Well, you can upload directly from the problem's page.
 » 3 years ago, # |   +11 WTH????!!!!
•  » » 3 years ago, # ^ |   0 I'm guessing its a glitch.There were some reports yesterday about people who dropped below 1900 after the contest but still retained their colour.
•  » » 3 years ago, # ^ |   +1 Yesterday I got to green but my rating was still in grey. Some kind of bug I guess.
•  » » 3 years ago, # ^ |   +1 he gained the rating as well :)
•  » » 3 years ago, # ^ |   +6 It can backfire too
•  » » 3 years ago, # ^ |   +14 Sorry about that. I've registered as usual. I wrote to Mike. Hope he will fix it and there will be no rating changes for me. Also I didn't try to hack and no one hacked me.
•  » » » 3 years ago, # ^ |   +5 The same happened to me (although i lost rating) and i've wrote to mike too. I hope it will be solved or that it didn't affect others rating too negatively.
 » 3 years ago, # |   +4 I always get too slow while implementing problems like C. Hope the editorial explains clear thoughts on how to solve such problems correctly and faster.
•  » » 3 years ago, # ^ |   0 Yeah simulating the situation is pretty tough to implement but I'm not sure the intended solution is through simulation. I just used a bunch of if statements to solve it.
•  » » » 3 years ago, # ^ |   +1 Your solution is really well analysed. My code missed AC just bcoz of single line. I forgot to check that the tram can be at x1 in the beginning. ;_;
•  » » 3 years ago, # ^ |   +2 Exactly, It seems like more of math and less of logic , but yes i too want too learn how to solve such problems. I was thinking keeping this problem As Fast As Possible in mind but solution was a bit different.
•  » » » 3 years ago, # ^ |   0 Todays problem reminded me also of the problem you mentioned. I guess implementation is still a challenging task to work upon in CP.
•  » » 3 years ago, # ^ | ← Rev. 5 →   -7 I believe the idea is an event queue. When the tram passes by x1 or x2, we track that event.So, we could have 2 event queues: vector event_time_x1; vector event_time_x2; We are interested in events of second type event_time_x2, when tram passes by our target location. We just need to simulate tram's movement until we collect 2 events in the event queue event_time_x2. After that we compare the times contained in the queue event_time_x2 with the Igor's time when he is just walking to the target. If event_time_x2[0] ≥ walking_time, then there is no point in taking tram at all. If event_time_x2[0] < walking_time, then we need to track whether it was possible for Igor to get on the tram before tram has reached the target at event_time_x2[0]. To check that — we need to find the time, when the tram crossed Igor's location x1. If there was no event of crossing x1 location before the event event_time_x2[0], then it was not possible for Igor to reach target location x2 at the time the tram reached it event_time_x2[0]. After that, we check the second event. I failed on test 18, but I believe that my idea is correct. Probably I had to collect 3 events instead of 2. UPD: Yes, we need to store 3 passes of the tram: 23107366
•  » » 3 years ago, # ^ |   0 Same with me :(
•  » » 3 years ago, # ^ |   0 in C turns out you only need to consider 2 cases: walk all the way wait in x1 untill tram comes, then ride the tram here is my ac codehttp://codeforces.com/contest/746/submission/23108354
 » 3 years ago, # |   +2 WA problem C test 23 )= someone else?
•  » » 3 years ago, # ^ |   +1 WA too tc 19 ):
•  » » 3 years ago, # ^ |   0 WA on 23 :'(
•  » » 3 years ago, # ^ |   0 Noo!! it's the case when they start in the same position! I am so stupid!
•  » » 3 years ago, # ^ |   +4 I also had troubles here. Test case 23 starts with the train and the person at the same square, so that you can board the train instantly.So I would guess that you (like me) have a "> 0" in your code somewhere that should be ">= 0"
•  » » 3 years ago, # ^ |   0 wao, I really need to think more about this off by one error...
 » 3 years ago, # |   +1 That feeling when your solutions failed on system testing on problems C,D but submission on problem E got AC. And you went from 374 place to 1135. My ass is burning!!!
•  » » 3 years ago, # ^ |   0 Haha, similar thing happened to me. A,B,C passed and D,E failed.
 » 3 years ago, # |   +8 The difficulty is not sorted alphabetically.
•  » » 3 years ago, # ^ |   0 do you mean for F and G or the whole contest?
•  » » » 3 years ago, # ^ |   +9 I believe G was even easier than E... My personal opinion...
 » 3 years ago, # |   +6 Amazing Contest...Good doable questions...Thank you Writers :D
 » 3 years ago, # |   +30 The problem statement doesn't mention anywhere that the result will be an integer right? 23102907
•  » » 3 years ago, # ^ |   +3 The same reason prevented me from even starting to implement C.
•  » » » 3 years ago, # ^ |   0 same here
 » 3 years ago, # |   +12 I think problem E has weak testcases.Example: 4 20 1 5 4 5 The answer should be something like: 1 1 2 4 5 My program outputs: 2 2 3 4 5 
 » 3 years ago, # |   0 Can someone explain why did my code fail?23085756
•  » » 3 years ago, # ^ |   0 I had the exact same doubt.
•  » » 3 years ago, # ^ |   +22 Unsigned integer underflow i = str.sz - 2 ; When str.size() = 1, then this value goes to a very large value.
 » 3 years ago, # |   +4 so I failed 2 contest in 3 hours ...
 » 3 years ago, # |   +20 Access denied to editorial :(
•  » » 3 years ago, # ^ |   +4 Use this link: http://codeforces.com/blog/entry/49160
 » 3 years ago, # |   +1 Would this contest be scored?
 » 3 years ago, # |   +17 Is the Editorial accessible? I am receiving "Access Denied".
•  » » 3 years ago, # ^ |   +3 Use this link: http://codeforces.com/blog/entry/49160
 » 3 years ago, # |   +5 I wish we had more time, like 3 hours.
 » 3 years ago, # |   +11 What happens when "Bad Luck" is your best friend??? Compare these submissions- 23086486 and 23105642
 » 3 years ago, # |   +4 Thank you for a really awesome contest!
 » 3 years ago, # |   0 I am getting WA in pretest 9. Can you please provide a smaller but equivalent test case? My submission: http://codeforces.com/contest/746/submission/23106759
•  » » 3 years ago, # ^ |   0 19 2 7 12
 » 3 years ago, # |   +17 that moment when increased rating on div2 contest being div1
 » 3 years ago, # |   0 Can't access editorial
•  » » 3 years ago, # ^ |   +3 Use this link: http://codeforces.com/blog/entry/49160
•  » » » 3 years ago, # ^ |   0 Thanks :)
 » 3 years ago, # |   -15 My sad story :-(
 » 3 years ago, # |   +1 Limits of problem C are too small ,So some solutions passed by simulation.
 » 3 years ago, # |   0 I regret being unable to give the contest, there's one tomorrow also right? Will give both tomorrow, one virtual one real. OK, have one now. Congrats to the winners! This has been a great Christmas Contest season.
 » 3 years ago, # |   0 access denied on clicking editorial ?
•  » » 3 years ago, # ^ |   +1 Use this link: http://codeforces.com/blog/entry/49160
•  » » » 3 years ago, # ^ |   0 Thanx a lot mate :)
 » 3 years ago, # |   0 Editorial says:
 » 3 years ago, # | ← Rev. 2 →   +4 sorry