### smahdavi4's blog

By smahdavi4, 5 years ago,

Hi everybody!

On Saturday, August 12, 2017, at 14:35 UTC Codeforces Round #428 will be held. As usual, Div.1 participants can join out of competition.

The problems are prepared by me(Sadegh Mahdavi) and NikaraBika(Majid GarooC). Great thanks to Arpa(AmirReza PoorAkhavan) and Livace(Alexey Ilyukhov) for testing the round, KAN(Nikolay Kalinin) for helping us preparing the round and MikeMirzayanov(Mike Mirzayanov) for the Codeforces and Polygon systems.

There will be 5 problems and 2 hours to solve. The scoring will be published later.

The main characters of this round are chosen from the game of thrones series :D

UPD : The scoring is : 500 — 1000 — 1500 — 2000 — 2500

UPD: The judges solutions for problem B incorrectly handled some case, so we are going to rejudge some of the hacks. The pretests are not affected, so the contest is going to be rated.

UPD : The round is finished. Congratulations to winners:

Div 2:

2.fatego

3.regmsif

4.Lyra

Div 1:

1.dotorya

2.kmjp

4.Benq

5.Claris

UPD Editorial

• +220

 » 5 years ago, # | ← Rev. 2 →   +75 There aren't going to be spoilers in the statements right?
•  » » 5 years ago, # ^ |   +9 Nope. Many parts of the problems are written by ourselves and are not real :)
•  » » » 5 years ago, # ^ |   +4 Wrong problem statements
 » 5 years ago, # |   +122 I guess problems will have lot of hacks. HBO, inspiration...
•  » » 5 years ago, # ^ |   0 Star India appears to have leaked the episode online through its own website.
•  » » » 5 years ago, # ^ |   +10 Thanks for your dedicated information.
 » 5 years ago, # |   +12 :DI'll be very disappointed though, if nobody dies, or if there are no dragons/mad kings/queens causing explosions.
•  » » 5 years ago, # ^ |   +20 Well, problem B killed everyone anyway ;)
•  » » » 5 years ago, # ^ | ← Rev. 2 →   +7 careful what you wish for, lolHaha, daenerys got 8000 unsullied. today 8000 competed. the unsullied are trapped at Casterly rock(will die), and so did all of us.Was this prophecy?
•  » » » » 5 years ago, # ^ |   0 No, mostly spoilers.
•  » » » » » 5 years ago, # ^ |   0 my pleasure :v
 » 5 years ago, # | ← Rev. 3 →   -7 I think this is very fast announcement of the year (because it published ~60 hours before contest) thank you very much. Hope editorial is fast as announcement.
•  » » 5 years ago, # ^ |   -74 Very faster? Seriously? RIP. ENGLISH
•  » » » 5 years ago, # ^ | ← Rev. 2 →   +16 OK. Fixed. Sorry for my poor English.
•  » » » » 5 years ago, # ^ |   -89 I mean, is it correct way to use very faster?
 » 5 years ago, # |   +2 Why isn't the announcement on the homepage ?
 » 5 years ago, # |   +5 tank you Arpa. anybody know how the pdf will be published????
 » 5 years ago, # |   +20 So I've been off Codeforces for a couple of months and then I see this Game of Thrones themed round. I couldn't get a bigger motivation to come back. Thank you for this. :)
•  » » 5 years ago, # ^ |   +38 Bend the knee :-P
•  » » » 5 years ago, # ^ |   +18 But mah people... :D
•  » » » » 5 years ago, # ^ |   +1 Bend the knee
•  » » » » » 5 years ago, # ^ |   0 You are too harsh on me, Aunt!
•  » » » » » » 5 years ago, # ^ |   +14 I thought you knew nothing :O
•  » » 5 years ago, # ^ |   0 Placing Daenerys Targaryen's army(#428 B) was very painful , finally receiving WA . I hate her weird choice O:)
 » 5 years ago, # |   +11 When one of your friend didnt watch the show.
•  » » 5 years ago, # ^ |   +11 When you're just doing the contest*
 » 5 years ago, # |   +3 Why can't GRRM use twitter?, he killed all 140 characters. I'm struggling to think of a suitable pun for why he can't write problem statements.
 » 5 years ago, # | ← Rev. 3 →   -20 OMG!!! This is going to be my favorite round perhaps ever! :)I guess problems would be like; given seven kingdoms, three dragons (and their mother), one mad queen, a man who still knows nothing, how would you assign these kingdoms optimally?, haha I forgot the WHITEWALKERS!Hope it will be as exciting and fun to watch as the show :)
 » 5 years ago, # |   0 I hope that the problems will be as short as this post :)
 » 5 years ago, # |   -20 I hope no one will die in problem statements like it's popular in Game of Thrones))
•  » » 5 years ago, # ^ | ← Rev. 2 →   -20 BooHooDracarys
•  » » 5 years ago, # ^ |   +13 Valar morghulis.
•  » » » 5 years ago, # ^ |   +8 Valar Dohaeris <3
 » 5 years ago, # |   -10 Any age restrictions like ROUND ONLY FOR 18+ USERS?
 » 5 years ago, # | ← Rev. 2 →   +23 Problem statements be like : If Gendry started rowing in season 3 and Varys travelled from Dorne to Meereen in one episode, then where dafuq is Gendry?
•  » » 5 years ago, # ^ |   +2 Rowing.
 » 5 years ago, # |   0 please dont ask us to bend the knee :X
 » 5 years ago, # |   0 I know nothing . But I am gonna participate .
 » 5 years ago, # |   0 It sounds interesting. Really excited for the round.Wish that the problem statements are as short as the announcement.
 » 5 years ago, # |   -44
 » 5 years ago, # |   -54
•  » » 5 years ago, # ^ |   -14 I miss Tywin ;_*
•  » » 5 years ago, # ^ |   +19 Dude don't post this shitty big pictures
 » 5 years ago, # |   -7 Interesting round :)
 » 5 years ago, # |   +50 Am I the only one in the world who hasn't watched this series yet??? :\
•  » » 5 years ago, # ^ |   0 no i didnt watch it too but i heard its one of the best series :)
•  » » 5 years ago, # ^ |   +2 I haven't watched it but read the whole plot of this season and now I am giving away free spoilers to people who watch it :v
•  » » » 5 years ago, # ^ |   0 cool boy
 » 5 years ago, # |   +1 I won't be able to focus on the problems, I will be thinking what's going to happen instead.
»
5 years ago, # |
+2

Leave one Problem unsolved, and the programmers are never safe.

# GOT_FAN

 » 5 years ago, # |   -6 WoW GoT...excited for the problem statements. "WHEN YOU PLAY THE GAME OF THRONES, YOU WIN OR YOU DIE."
 » 5 years ago, # |   0 Snapdragon has beaten tourist in GCJ World Finals. He's the new king of seven kingdoms.
•  » » 5 years ago, # ^ |   +14 The long input file result hasn't been calculated yet
•  » » 5 years ago, # ^ |   0 And the Andals, and First Men. Protector of the realm...
•  » » 5 years ago, # ^ |   +3 UPD: Tourist won it in system testing.
•  » » 5 years ago, # ^ |   0 king in the north remains, long long live the king!!
•  » » 5 years ago, # ^ |   +3 There is only one true king !
 » 5 years ago, # |   +4 i know nothing jonsnow;(
 » 5 years ago, # |   -11 probably worst round ever as it is related with got
 » 5 years ago, # |   0 Dracarys!! :D
 » 5 years ago, # |   -32 is it rated ?
•  » » 5 years ago, # ^ |   0
•  » » 5 years ago, # ^ |   +2 Ahh the dreaded comment ! :D
•  » » 5 years ago, # ^ |   0 We get such kind of comment in every announcement..
 » 5 years ago, # |   -10 --novice_dev-- you are not eligible for this contest
 » 5 years ago, # |   +15 Game of Thrones + Codeforces = Game of tourist
•  » » 5 years ago, # ^ |   -19 haHaa
•  » » 5 years ago, # ^ |   -19 Verrrrrrrrrrrrrrrrry funny :/HAHAHAHAHAHAHHAHA :|
•  » » » 5 years ago, # ^ |   0 Hah can't understand why those kids find it funny
 » 5 years ago, # |   -10 When does the contest starts?
 » 5 years ago, # |   +6 I am new to programming and want to step into world of competitive programming. Is this a right platform for me to start competing ? What kind of questions will be there in this ?? SHould i participate in it ??Please let me know! Thanks.
•  » » 5 years ago, # ^ |   +13 It's really good. Codeforces is the only practice website I'm active on and there are lots of problems for you to solve for different skill levels. I recommend going to the problem set tab and clicking on solved to see the most solved problems and starting with those. You can see the types of questions they usually have by looking at previous contests, like this one.
 » 5 years ago, # |   0 Best coder throne currently occupied by tourist :D
 » 5 years ago, # |   +12 I hope that I'll perform better than Lanisters' army in last battle.
 » 5 years ago, # |   -23 Hope there will be Emilia Clarke's nude pictures in statements
 » 5 years ago, # | ← Rev. 2 →   -13 Is there any PDF for translation statements to Persian ?
•  » » 5 years ago, # ^ |   0 Unfortunately, it isn't possible to publish the persian statements, we are sorry to persian users.
 » 5 years ago, # |   0 hacked solution like killed by white walkers, once you hacked and you find out the mistake so you can make others same by trying same hack. :D
 » 5 years ago, # |   +13
•  » » 5 years ago, # ^ |   0 haha...nice one
 » 5 years ago, # | ← Rev. 3 →   +1 I hope that this round will be successful. Good luck for everyone!
 » 5 years ago, # |   +1 I Think I am the only one who haven't watched this movie.. !! :D
•  » » 5 years ago, # ^ |   +7 no one has! XD
 » 5 years ago, # |   0 Scoring distribution
 » 5 years ago, # |   +5 Registered users: Cro-Marmot, 172340, Cro-Marmot, 172340, 1040865060, ...Hmm, that's suspicious...
•  » » 5 years ago, # ^ |   -15 蛤？
 » 5 years ago, # |   +1 About to start, Good luck everyone! I wish you all High rating!
 » 5 years ago, # |   0 Problem A says "Your task is to find the minimum number of days Arya needs to give Bran k candies before the end of the n-th day." But on querying, the problem actually is minimum number of days Arya has to take candies from the God to give k candies to Bran. The problem statement is wrong IMO.
•  » » 5 years ago, # ^ |   0 what the test case 7 ?
•  » » » 5 years ago, # ^ | ← Rev. 2 →   -18 Test-12 3 1 2She can save and give 3 candies to Bran on the 2nd day and hence the number of days Arya gave candies to Bran is 1 not 2
•  » » » » 5 years ago, # ^ |   0 but the author says 2 days !
 » 5 years ago, # |   -9 Two unclear problem statements? Great contest. :D
 » 5 years ago, # |   -28 This was one of the worst codeforces rounds ever.
•  » » 5 years ago, # ^ |   -9 Wouldn't qualify it as "worst." But it definitely was kind of rough
•  » » 5 years ago, # ^ |   +2 Saying this because you couldn't solve a tricky problem won't change anything
 » 5 years ago, # |   +22 Pretests 7 in B and 5 in C;
•  » » 5 years ago, # ^ |   +4 Solutions for problem B of even reds failed in pretest 7.
•  » » » 5 years ago, # ^ |   +12 I thought the same thing until I saw this "We call two seats neighbor, if they are in the same row and in seats {1, 2}, {3, 4}, {4, 5}, {5, 6} or {7, 8}" Did you notice this?
•  » » » 5 years ago, # ^ |   0 Just used float instead of double and got AC -_-. What the hell happened in C?
•  » » 5 years ago, # ^ |   0 yeah i failed 5 c because i wasn't calculating the probability of choosing the path i was just printing sum(root->leafs) / number of leafs
•  » » 5 years ago, # ^ |   +7 A bit more productive version: "But I will find you and I will solve you"
 » 5 years ago, # |   +1 That pretest 7 in B killed me
 » 5 years ago, # | ← Rev. 2 →   +159 I think the judge solution maybe wrong for B. I did a hack using following test case:4 132 2 2 2 2 2 2 2 2 2 2 2 4(4 rows, 12 groups with 2 soldiers each + 1 group with 4)The judge solution gives "NO" for this case, but there is a solution:[1][1] [5][5][.][13] [9][9][2][2] [6][6][.][13] [10][10][3][3] [7][7][.][13] [11][11][4][4] [8][8][.][13] [12][12]
•  » » 5 years ago, # ^ |   -10 Use formatting
•  » » 5 years ago, # ^ |   +22 Yes, I made a similar hack:3 10 2 2 2 2 2 2 2 2 2 3 And system sayd me the answer is NO. Should be YES.
•  » » » 5 years ago, # ^ | ← Rev. 2 →   0 My program finds the solution in this case :)
•  » » 5 years ago, # ^ |   0 Really? It's terrible.
•  » » 5 years ago, # ^ | ← Rev. 4 →   -72 The answer "NO" is correct.We use 8 "2 - placed" seats for groups of 2.4 groups of 2 soldiers and 1 group of 4 soldiers remain.This group with 4 soldiers will use one 4 - placed seat.Now there are 3 "4 - placed" seats and 4 pairs of solders.You cannot place them without breaking the rule.
•  » » » 5 years ago, # ^ | ← Rev. 4 →   0 Then how about this: [1][1] [7][7][ ][10] [2][2][3][3] [8][8][ ][10] [4][4][5][5] [9][9][ ][10] [6][6] hopefullly the author had taken this situation into account.So I'll fail the system test, defanitely :-(
•  » » » » 5 years ago, # ^ |   0 You need to put 2 spaces in the end and it will split the text into lines.
•  » » » » » 5 years ago, # ^ |   0 thanks
•  » » 5 years ago, # ^ | ← Rev. 2 →   +5 Now it looks like even Um_nik will fail (submission 29384447)
•  » » 5 years ago, # ^ |   0 i think i had a very simple sol before: Solutionint sm = 0, odd = 0; for(int i = 1; i <= k; i++){ int t; cin >> t; sm += t; if(t & 1) odd++; } if(8 * n >= sm + odd){ cout << "YES"; }else cout << "NO"; is it correct??
•  » » » 5 years ago, # ^ | ← Rev. 2 →   0 I was wrong, see below.
•  » » » 5 years ago, # ^ |   +3 1 4 2 2 2 2It should output NO.
•  » » 5 years ago, # ^ |   0 I hacked 4 users with this test, but I didn't understand why?
 » 5 years ago, # | ← Rev. 2 →   0 Problem B _/_
 » 5 years ago, # |   +2 Hack for B:1 4 1 1 2 2
•  » » 5 years ago, # ^ |   0 Yes right?
•  » » » 5 years ago, # ^ |   0 Yes, yes
•  » » 5 years ago, # ^ |   +3 I think many will fail B after the full judging
•  » » 5 years ago, # ^ |   0 Ehh, I fail this one too...
 » 5 years ago, # |   0 Hack Cases for A and B ?
 » 5 years ago, # |   0 Hacks for B?I didn't hack anyone but this test broke my first pretests-passing submission:4 102 2 2 3 3 3 3 3 3 3Answer should be no I believe.
 » 5 years ago, # |   0 Ideas for E please, TIA.
•  » » 5 years ago, # ^ |   0 What I did was finding the maximal component where each vertex has degree equal to or more than i (1<=i
•  » » 5 years ago, # ^ |   0 Find the maximum clique in the graph. Suppose it has t nodes, the result is .
•  » » » 5 years ago, # ^ |   0 Can you please explain this?
•  » » » » 5 years ago, # ^ |   0 This may help you . http://mathworld.wolfram.com/TuransTheorem.html
 » 5 years ago, # |   0 I used greedy in B, take seats in the middle segment first. Hope it pass
•  » » 5 years ago, # ^ |   0 I think this should fail:1 32 2 4
 » 5 years ago, # |   +5 For E , is it correct that optimal answer is always a Clique?
•  » » 5 years ago, # ^ |   0 We might have the same idea. Run under timelimit, hope that it converge. :)
•  » » 5 years ago, # ^ | ← Rev. 2 →   0 I was thinking in lagrange multipliers, what do you mean by clique? is a pentagon ABCDE with a triangle ACE a counterexample?
•  » » » 5 years ago, # ^ |   0 for pentagon answer is while for triangle answer is so clique works better.
•  » » » » 5 years ago, # ^ |   0 I understand that bigger clique is better than smaller, but can you explain why clique is always the best ?
•  » » » » » 5 years ago, # ^ |   0 this is just a guess , i have no proof.
•  » » 5 years ago, # ^ |   +41 Yes. Consider solution that distributes xi liquid to vertex vi. Suppose there is no edge between vi and vj. If we fix t = xi + xj and change xi, then answer is linear function of xi (because only summand that is could be not linear of xi is aij·xi·(t - xi) = aij·xi·xj, which is zero). So in one of optimal solutions either xi = 0, either xj = 0. Now fix any optimal solution with maximum numbers of zeroes. In this solution any vertices with non-zero numbers are connected. So, answer should be a clique.
•  » » 5 years ago, # ^ |   +24 I proved it with following way:Lemma. There is an optimal way to give numbers to each vertex as this way: only some vertex v and it's neighbors can have positive values, and every other vertex has 0 value.Proof: Suppose that you have some optimal way to give values to vertices. For each vertex, calculate sum of values written in neighbor vertices. Find a vertex which has maximum value, and let this vertex v. Suppose we have vertex w != v, which is not a neighbor of v, and has positive value written. Then, we can just add value of w to v, and make value of w 0. This will make better result for problem. It means that all vertices except v and it's neighbors should have 0 value to have optimal solution.If we use above lemma, we can show that answer only depends on maximum clique by induction.Theorem: the answer for some graph that maximum clique is K is equal to answer for perfect graph with K vertices.Proof: 1) K = 1 -> Easy to show. 2) If above theorem holds for some K, it should hold for K+1 also.By lemma, we can take some vertex v and it's neighbors, and erase all other vertices from the graph. In this modified graph, suppose we can get rid of vertex v and think it later. (It's correct. We can find which value to write in vertex v, only depending on answer on graph without v) Then left graph should have just K-clique. So this graph is equal to perfect graph with K vertices by induction. By adding vertex v again, it becomes perfect graph with K+1 vertices.
 » 5 years ago, # |   +29 In problem B, the answer for 3 10 2 2 2 2 2 2 2 2 2 3 should be YES, but judge outputs NO. Am I wrong thinking the answer is YES, or the judge is incorrect, and we will have to face another unrated contest?
•  » » 5 years ago, # ^ | ← Rev. 2 →   -14 :p
•  » » 5 years ago, # ^ |   0 How would you organize it so that it's yes? I can't think of a way.
•  » » » 5 years ago, # ^ |   +11 We put 6 2s in the 6 2 seats, and 3 2s in the 4 seats, leaving 1 seat open in all 3 4 seats, and we can put the 10th 3 in 3 pieces to the leftover 1 seats.
•  » » » 5 years ago, # ^ |   +11 1 1 | 2 2 . 10 | 3 34 4 | 5 5 . 10 | 6 67 7 | 8 8 . 10 | 9 9
•  » » » 5 years ago, # ^ |   +3 The answer is definitely YES1 1 2 2 . 10 3 34 4 5 5 . 10 6 67 7 8 8 . 10 9 9
•  » » » 5 years ago, # ^ |   0 Similar to the arrangement here
•  » » » 5 years ago, # ^ |   +5 This way
•  » » 5 years ago, # ^ |   0 You are wrong. We have 6 2-placed zones and 3 4-placed, 6 two-using groups sending to 6 2-placed, so we have only 3 4-placed zones and 2 2 2 3, we can't put groups on them, cause different groups can't seat with each other (sorry for my poor endlish :D)
•  » » 5 years ago, # ^ | ← Rev. 2 →   +4 It's yes, ofcMy solution passed pretests and it gives YESUPD: 29391756 passed systests =)
•  » » » 5 years ago, # ^ |   +3 Mine passed with outputing NO, but I tried to hack someone with this case, and it went unsuccessful, because judge outputs NO too.
•  » » 5 years ago, # ^ |   0 yes the answer should be YES
 » 5 years ago, # |   +12 Ideas for D?
•  » » 5 years ago, # ^ |   +4 iterate over the GCD from 1 to 1000000 and find the answer exactly for that gcd and add it to the final answer.
•  » » 5 years ago, # ^ |   0 Inclusion/Exclusion + DP.My code: http://ideone.com/BG4EtW
 » 5 years ago, # |   +3 Now that the contest is over, can anyone share how they passed test case 5 in problem C? :'(
•  » » 5 years ago, # ^ |   +1 you need to calculate sum( probability of reaching the leaf * depth[leaf]), instead of sum( of paths to leafs) / number of paths
•  » » » 5 years ago, # ^ |   0 Ohhh... I can't believe I didn't realize something so simple hahaha
•  » » 5 years ago, # ^ |   +3 I fixed it by calculating for each destination the probability to reach there * their length. For each node the probability to reach its children would be the probability to reach itself divided by the number of children (with node 1 being probability of 1). The expected length is then the sum over all of the destinations.
•  » » 5 years ago, # ^ |   +3 Expectation(node){ E = 0.0; d = 1.0/number_of_children for each v in node.children: E+= (d)*(1+Expectation(v)); return E } 
•  » » 5 years ago, # ^ | ← Rev. 2 →   0 Getting to different ends in the tree have different probabilities.Consider the input 5 1 2 1 3 3 4 3 5 Getting to 2 have probability = 0.5 whereas getting to 4 and 5 have probability = 0.25 each
 » 5 years ago, # |   +8 It's not a bad round but the language could have been better. Tbh who the fuck wrote the statements, There were typos everywhere and caused me to even misunderstood Problem A.
•  » » 5 years ago, # ^ |   0 *misunderstand
•  » » » 5 years ago, # ^ |   -12 U nailed it brother!@kapslocker
 » 5 years ago, # | ← Rev. 2 →   +4 In Prob B 2 7 2 2 2 2 2 2 2 Should be "YES"1 1 2 2 0 3 4 4 5 5 6 6 0 3 7 7but STD output "NO" ????????
 » 5 years ago, # |   +6 We need to find summation of 1.kC1 + 2*kC2 + 3*kC3 + .... k*kCk for D right ?
•  » » 5 years ago, # ^ |   0 I did that and some inclusion exclusion but have WA4, in any case that sum is k*2k-1
•  » » 5 years ago, # ^ |   0 Yes, then apply Pinex not to count twice some sets {6} in the example 2,3,6.
•  » » 5 years ago, # ^ | ← Rev. 4 →   +3 yeah. kCa = kC(k-a), so you can rewrite it as (k/2)*kC0 + (k/2)*kC1 + ... (k/2)*kCk = (k/2)*(kC0 + kC1 + kC2 + .. kCk) = k*(2^(k-1))
•  » » 5 years ago, # ^ |   0 I used Mobius inversion Formula (I knew it was totient) and Inclusion Exclusion for g=1.BTW The summation is equivalent to k * 2 ^ (k-1)
•  » » » 5 years ago, # ^ |   0 I don't know that and had to derive a formula in last few mins and i couldn't.
•  » » 5 years ago, # ^ | ← Rev. 4 →   +37 I derived it in this way -> Binomial expansion is, Derivating on both sides with respect to x,Substituting x = 1 on both sides,
•  » » » 5 years ago, # ^ | ← Rev. 2 →   0 Or you could reverse the series S and add it to itself. You get 2*S = n*(sigma(nCi))
•  » » 5 years ago, # ^ |   0 Can you please tell me how to get this formula?
 » 5 years ago, # |   0 WA in A,B,C. solution for C: sum over depths of leaves/ number of leafs. Cant wait to see which mistakes I made.
•  » » 5 years ago, # ^ |   0 For begin I'm too did as you did. Then I solved so: when you went to vertex in DFS you should know probability visits to this vertex, children's probability such: (parent_probability)/(count_children). If vertex is leaf then ans += depth*probability_vertex.
•  » » 5 years ago, # ^ |   +3 Sum of depths of leaves divided by the number of leafs is wrong. You have to take into account the probability of reaching every leaf (you have assumed the probability of each branch from the root node to be equal, which is not the case, as there is a branching factor at every node, not just the root). The line "In each such city, the horse goes with equal probabilities and it stops when there are no such cities" mentions this.
•  » » » 5 years ago, # ^ |   0 Thank you sir! I didnt even realise you need to care about that.
 » 5 years ago, # |   -10 fuck u -> precision coz it fucked up my rating.
•  » » 5 years ago, # ^ |   0 Is this in problem C?
•  » » » 5 years ago, # ^ |   0 yeah
 » 5 years ago, # |   +44 In problem B, why is this white line here? I thought the seats 4 and 5 are not neighbours... :/
•  » » 5 years ago, # ^ |   +39 So {1, 2} and {7, 8} are not neighbours as well... :/
•  » » 5 years ago, # ^ |   +6 even I thought that.As it is just a div2 B it has to be under estimated :P
 » 5 years ago, # |   0 How to solve C ? Also , any idea on what could be the 4th pretest ?
•  » » 5 years ago, # ^ |   0 2 2 1
•  » » » 5 years ago, # ^ |   0 answer is 1 ,right ?
•  » » » » 5 years ago, # ^ |   +1 ofc, you just need to make directed graph, not non-directed as I did. After doing this, I've got WA on 5th test...
 » 5 years ago, # |   0 Problem B: add this test case in system tests please: 1 4 2 1 2 2
•  » » 5 years ago, # ^ |   0 Most times they add all successful hack cases to system tests.
•  » » 5 years ago, # ^ |   0 This is YES/NO problem, and there can be so many different test cases! I think it is not late to make sure, that system test contains at least 150 TCs.
•  » » 5 years ago, # ^ |   0 And anyways, probably 90% of solutions will fail on test cases, which the judge failed too during the contest, so there will be at most 100-200 solves I think.
•  » » 5 years ago, # ^ |   +3 the answer is "YES".
 » 5 years ago, # |   +6 The contest was quite nice (really liked the D). B was really annoying, tho as long as the problem is correct, I'd rather blame myself. All of this being said, the statement problem with problem C was extremely annoying and I've spend precious minutes trying to implement a root changing algorithm instead of writing the straight-forward one root solution. I almost ran out of time to write D because of this, so please, at least ignore the submissions before the announcement.
•  » » 5 years ago, # ^ |   +1 What was your idea for a root changing algorithm?
 » 5 years ago, # | ← Rev. 3 →   +5 I hacked a person who submitted this code for A, my hack case was n=100, k=10000 and a_i=1 for all 1<=i<=100. His while loop should have continued pass i=100 and have very undefined behavior, yet somehow it gave the correct answer. How? #include using namespace std; int main() { //code int n,k,i,temp; cin >> n >> k; int arr[n]; for (i=0;i> arr[i]; int num = k; i=0; temp = 0; while(num>0) { num = num — min(8,arr[i]+temp); temp = temp — min(8,arr[i]+temp); temp+= arr[i]; i++; } if (i>n) cout << -1; else cout << i; return 0; } 
•  » » 5 years ago, # ^ |   +6 Just because it's undefined does not imply it's wrong. I guess he was just very lucky!
•  » » 5 years ago, # ^ |   +1 statement says a_i>=1 , you should have gotten invalid input for a_i = 0
•  » » » 5 years ago, # ^ |   0 My mistake, my hack actually had a_i=1.
 » 5 years ago, # |   +7 for problem C i rooted the tree then had a function solve (i, d, prob) , i is index of current node, d is its distance from the root (the root is node 1), prob is the probability of reaching node i, prob starts by 1 and on each recursive call for solve the node i passes to its child the third parameter as prob multiplied by number of children of node i, when we reach a leaf node we add to the answer the distance of the leaf node from the root divided by prob, but WA at test 10, any ideas ?
•  » » 5 years ago, # ^ |   +1 Most probably overflow.Your prob parameter may reach upto 2^2500 if you analyse.The trick was to prune the tree after prob parameter is sufficiently large.
 » 5 years ago, # |   0 For problem C I tried foreach(branch : graph[1])answer+=branch_depth/graph[1].size() this is what I got from the attached wiki link, what's the solution should be ?
 » 5 years ago, # |   -18 The statement of problem B never specifies that the seats {3,4,5,6} are neighbor. "We call two seats neighbor, if they are in the same row and in seats {1, 2}, {3, 4}, {4, 5}, {5, 6} or {7, 8}.". This round should be unrated......
•  » » 5 years ago, # ^ |   0 3 and 6 are not neighbors
•  » » 5 years ago, # ^ |   0 3 is not a neighbor to 6. Only the pairs specified are neighbors. You can have different soldiers in seats 3 and 5, for example.
 » 5 years ago, # |   +40 B was really annoying. Although pretests was not affected,but hack was. After Unsuccessful hacking I spent a lot of time on it. It should be UNRATED
•  » » 5 years ago, # ^ | ← Rev. 2 →   +39 I support your opinion. Time is invaluable in Codeforces Rounds. This contest should be UNRATED!
•  » » 5 years ago, # ^ |   +45 If your solution was successfully hacked by incorrect hack, you could have also spent time on it, trying to find a bug in a correct solution.
•  » » 5 years ago, # ^ |   +19
•  » » 5 years ago, # ^ |   +23 Also, I tried to hack with a correct hack, but I got unsuccessful. If I had succesful, I could have hacked more people with it, ending with more points.On the other hand, even with a failed B, I'll end up with positive delta in rating, so I'll be happy if the contest stays rated, but I also think it shouldn't.
•  » » 5 years ago, # ^ |   0 How you are affected by this issue as I see you never tried to hack any solution nor your solution got hacked
•  » » » 5 years ago, # ^ |   0 I do. The hack ID is 341785. It was unsuccessful during the contest. And it was Ignored after the contest.
•  » » 5 years ago, # ^ | ← Rev. 2 →   0 You are right pantw:)
 » 5 years ago, # |   +7 I think i should have a good sleep .
•  » » 5 years ago, # ^ |   0 Gn
 » 5 years ago, # |   0 "The judges solutions for problem B incorrectly handled some case, so we are going to rejudge some of the hacks. The pretests are not affected, so the contest is going to be rated." AND WHAT ABOUT THE TIME WE WASTED IN FINDING THE BUG? CANT BELIEVE YOU GUYS
•  » » 5 years ago, # ^ | ← Rev. 5 →   0 Pretests were correct, be quiet, turn off caps-lock and put the gun in your hand to table, no need to kill testers.But this is good reason to make contest unrated: http://codeforces.com/blog/entry/53773?#comment-378155
•  » » » 5 years ago, # ^ |   -37 first go and learn to spell properly..there is a huge difference b/w "quite & quiet" kiddo
•  » » » » 5 years ago, # ^ |   0 It's not grammar mistake, I just mixed two letters, anyway, if my English is bad, so I can't write anything?
•  » » » » » 5 years ago, # ^ |   -11 peace bro..i wrote what i felt ..valar morghulis
•  » » » 5 years ago, # ^ |   +9 be quiet, turn off caps-lock and put the gun in your hand to tabletake your well-deserved upvote, sir
 » 5 years ago, # |   0 Why are the system tests taking so long?
•  » » 5 years ago, # ^ |   0 I think they are checking the std of B.
 » 5 years ago, # |   +10 I don't know if it is kinda template or not but this two codes are same:http://codeforces.com/contest/839/submission/29409014http://codeforces.com/contest/839/submission/29406327
•  » » 5 years ago, # ^ |   0 Their solutions to A also has a more or less line-by-line correspondence.
 » 5 years ago, # | ← Rev. 2 →   +6 Oohoo, minimum number of days must be minimum number of index problem A, I think many contestant lost time on problem A !!!! LOL
 » 5 years ago, # |   +3 Are there tests that cause a stack overflow in Java for C? Cause I resubmitted with iterative DFS just to make sure...
•  » » 5 years ago, # ^ |   0 Yeah my solution just crashed on the max case. Guess it's failing system tests.
 » 5 years ago, # | ← Rev. 2 →   0 Can you share some information about the hacks that helped to identify the bugs???
•  » » 5 years ago, # ^ |   +3 10 3 2 2 2 2 2 2 2 2 2 3Answer is YES, judge outputs NO. I tried to hack with it, and got unsuccesful.
 » 5 years ago, # |   0 I cannot Understand the problem in my C problem code.... can anyone help? i simply did a DFS on the undirected graph and found the distances of leaves... take their mean. What am i doing Wrong for Pretest 5?
•  » » 5 years ago, # ^ | ← Rev. 2 →   +1 51 21 32 42 5Remember, there is a different probability that the horse ends up at cities 4 and 5 than the probability that he ends up at 3.
•  » » » 5 years ago, # ^ |   0 Thanks a lot... i didn't consider the probability of going to one branch.
 » 5 years ago, # |   +25 Wikipedia reference was added to problem C statement without an announcement !
•  » » 5 years ago, # ^ | ← Rev. 3 →   +21 In fact, there were lots of edits without announcement!As an example, at the start of the contest, I opened all problems, and my B problem said: "The second line contains n integers", I thought they should have been just k integers, so I refreshed and it suddenly said: "The second line contains k integers".Also I remember that happening one more time, but don't exactly remember where.EDIT: Now I remember, exactly in problem C, haha, it said: "What is the of their journey?", yes... unbelievable.
•  » » » 5 years ago, # ^ |   +5 codeforces should choose problem setters well or at least test problems many times by different persons
 » 5 years ago, # |   +51 Another shitty contest, when you don't know whether to rate or unrate. All of that caused by trying to be too smart on B task...I understand such initiatives on harder tasks, but why B? It is supposed to be a little more difficult than A. Why trying to make it so tricky?
•  » » 5 years ago, # ^ |   0 Agree ,really bad case-bash problem.
 » 5 years ago, # |   0 How about using the pretest results for B and ignoring all hacking results? It seems like some red-rated contestants also made mistakes on B.
•  » » 5 years ago, # ^ | ← Rev. 2 →   0 But it's unfair for the participants who solved it with the totally correct solution.
•  » » » 5 years ago, # ^ | ← Rev. 2 →   0 Right. But it's better than unrating this whole contest. I actually don't know and I'm fine with both.
•  » » 5 years ago, # ^ |   0 I guess both sides will be satisfied by that.
 » 5 years ago, # |   -12 KAN what dafuq are you doing now?
•  » » 5 years ago, # ^ |   +23 Maybe working together with the setters, and testers to figure out what will they do. They need time for that.
 » 5 years ago, # |   +4 hack for B2 8 1 1 2 2 2 2 2 2 "YES"2 7 1 2 2 2 2 2 2 "YES"2 8 1 2 2 2 2 2 2 2 "NO"is it right?
•  » » 5 years ago, # ^ |   0 I think Claris got it right. You could actually use his solution to test.
•  » » » 5 years ago, # ^ |   0 for case: 2 7 2 2 2 2 2 2 2 I got "YES" from his solution, but I think the answer will be "NO"…
•  » » » » 5 years ago, # ^ |   0 for the case : 2 7 2 2 2 2 2 2 2 I have tested some "Accepted" solutions, but I got "YES" from them. Something wrong for standard solution?
•  » » » » » 5 years ago, # ^ |   +1 it is yes. [1][1] [2][2][][3] [4][4] [5][5] [6][6][][3] [7][7]
•  » » » » » » 5 years ago, # ^ |   0 sorry that I am wrong… and thanks a lot.
 » 5 years ago, # |   0 I used Hightail today for the first time. It worked nicely. Thanks to the maker(s).
•  » » 5 years ago, # ^ |   0 Could you explain more about it???
•  » » » 5 years ago, # ^ |   0 It's an application that helps you to check sample cases for your program. Please go through this blog about Hightail for details.
•  » » » » 5 years ago, # ^ |   +6 Tanks
 » 5 years ago, # |   +4 finally the testing started
 » 5 years ago, # |   +1 This contest must be unrated, I know someone can say that, I'm just thinking about myself, but I was thinking about problem B more than one hour, and why???sorry for poor English
•  » » 5 years ago, # ^ |   0 For me it is totally irrelevant will it be rated or not. But your reason for unrated is wrong, you were thinking about B and didn't solve it, so what ? It is solvable and it will have many accepted. Estimation is wrong, but not so tragic as it happened on some previous rounds.
•  » » » 5 years ago, # ^ |   0 That isn't but this is.
•  » » » » 5 years ago, # ^ |   +3 What time is wasted ? Pretests were correct, so good solution will pass it. If you missed hack, you can think what is wrong with your code, but why would you think about it when you do not have ability to change code ?
•  » » » » » 5 years ago, # ^ |   +2 I pointed to my comment not to it's parent. I could have had more successful hacks, if I used the test case more times, but as I saw unsuccessful I didn't try. I tried to find the mistake in my test case (I didn't waste my time, because like 5 minutes were left) and I couldn't, but I didn't hack more anyways.However as I pointed out here I don't have problems, just try to make everyone see every aspects of the issue.
•  » » 5 years ago, # ^ |   0 If round 421 ended unrated,I don't see why will this round be different.Please don't apply double standards KAN
•  » » » 5 years ago, # ^ |   +3 That problem was (probably) unsolvable, and no one solved the problem during the contest. This one is different, now the judge was incorrect, but many people got it AC on system test. I also think it would be more fair to make it unrated, but if they make it rated, it won't be double standards.
 » 5 years ago, # |   +10 Even though the system test began, my hack still shows unsuccessful, when it should be successful.
 » 5 years ago, # |   -14 my reaction after reading "we are going to rejudge some of the hacks"
 » 5 years ago, # | ← Rev. 2 →   +46 There are around 50 people affected by the issue in problem B. We will calculate ratings for all participants now, and after that (most likely tomorrow) will make it unrated for those affected who has negative rating change.I'm sorry for the issue.
•  » » 5 years ago, # ^ |   0 So will the hacking data be in the system test?
•  » » 5 years ago, # ^ |   +62 "negative raging change" I had a positive raging change after this contest :)
•  » » 5 years ago, # ^ |   0 I think it's the optimal solution, to make this as fair as possible for everyone, but this is still a problem. I don't know how many people were affected by it (I was), but it makes the positive rating change slightly smaller.
•  » » 5 years ago, # ^ | ← Rev. 2 →   0 when you publish ratings ?KAN
•  » » 5 years ago, # ^ | ← Rev. 2 →   0 This issue effected on me too, or I'm not rigth, KAN can you explain me what happened! UPD:Thanx
 » 5 years ago, # |   +6 they ignored all my hacks, and what does it mean??
•  » » 5 years ago, # ^ |   -14 it means all the users were correct on your given test case.. you should be grateful to the organiser as they did not give you negative points for this lol
•  » » » 5 years ago, # ^ |   -8 No just 2 or 3 of them were correct, other were incorrect, don't unswer if you don't know the unswer of question!!!
 » 5 years ago, # |   0 wow cool problemset (no)
 » 5 years ago, # |   +2 wow! 1800 pretest passed for B and just 300 accepts !!!
 » 5 years ago, # |   0 I am worried with tests for the problem D. Is 29406336 supposed to pass?
•  » » 5 years ago, # ^ |   0 Why should it not pass?
•  » » » 5 years ago, # ^ |   0 Calculation of the (1*C(n,1)+2*C(n,2)+...n*C(n,n)) requires O(n) time
•  » » » » 5 years ago, # ^ |   0 But sum of frequencies is N, right?
•  » » » » » 5 years ago, # ^ |   0 No
•  » » » » 5 years ago, # ^ | ← Rev. 2 →   0 A number from input adds to fcnt[i] only when i is divisor of the numberSo the complexity of your code is O(n*(MAX DIVISOR OF NUMBER)) So it fits well in tle. MAX DIVISORS OF NUMBER ~= O(NUM^(1/3)) (240 for 10**6)
•  » » » » » 5 years ago, # ^ |   0 Wow, absolutely. I haven't thought about that.Thanks
 » 5 years ago, # | ← Rev. 2 →   -15 Contest should be unrated as incorrectly handled some test-case for problem B. :|
 » 5 years ago, # |   0 When only 332 can solve a problem of category B in div 2 (including the div 1 players) and the author as well as the people related to this contest also make a mistake in writing the solution and testing, should the contest be considered even good?Why shouldn't it be unrated? it looks harsh that we had a contest after a week and it turned out to be like this. But when a problem was being made, didn't it feel that this was being somewhat awkward? Problem C was easy (it was normal expected value problem) and problem B was really tough. even div 1 solvers would have had hard time solving it. so does it seem like a div2 contest? it would been better if it was div1 + div2. it would been fairer.
•  » » 5 years ago, # ^ |   +5 A contest isn't rated when it's good, it is when it's fair. They handled the issue with the unfairness, so I see no reason to make it unrated.
 » 5 years ago, # |   0 Could smb explain me pretest 43 for problem B? 2 7 2 2 2 2 2 2 2 
•  » » 5 years ago, # ^ |   +1 11|22 3|44 55|66 3|77 The numbers mean the groups.
•  » » 5 years ago, # ^ |   0 11 22*3 44 55 66*3 77you can choose seat like something like up * is for empty seat
•  » » 5 years ago, # ^ |   0 7 Groups can be seated as follows: Group 1 at {1,2} at row 1 Group 2 at {5,6} at row 1 Group 3 at {7,8} at row 1 Group 4 at {1,2} at row 2 Group 5 at {5,6} at row 2 Group 6 at {7,8} at row 2 Group 7 Person 1 at {4} at row 1 Person 2 at {4} at row 2
 » 5 years ago, # | ← Rev. 3 →   0 If I understand correctly, my answer "NO" for problem B is correct, isn't it?
•  » » 5 years ago, # ^ | ← Rev. 2 →   0 11 22.3 4455 66.3 77 (dot is for seat left) so your ans is wrong
•  » » 5 years ago, # ^ |   0 AB CDEF GH 11 22 6 33 44 55 6 77 Hence answer will be YES
•  » » 5 years ago, # ^ |   +5 11|22 3|44 55|66 3|77 The numbers mean the groups.
•  » » » 5 years ago, # ^ |   0 Thanks, It was really interesting problem
•  » » » » 5 years ago, # ^ | ← Rev. 2 →   0 That problem was anything but interesting...
 » 5 years ago, # |   -17 One of the unorganised and unplanned contest because of the questions!!
 » 5 years ago, # | ← Rev. 3 →   -23 I downvoted this round. B problem was way too hard for standard B level.I finally found clean solution for B after contest:http://codeforces.com/contest/839/submission/29411599P.S. It looks like CodeForces became harder. So you have to run in order to stay at the same place (run=amount of training, place=rating). And if you want to grow you have to run twice as fast. It's so demotivating!
•  » » 5 years ago, # ^ |   0 That's pretty biased, you can't say Codeforces became harder just because one hard contest, and even if you could everyone has had the same promblem set, so as long as you did better than the other people with lower rating than you, you will stay in the same rating.
•  » » » 5 years ago, # ^ | ← Rev. 2 →   +9 Then let's make all Div2 rounds where all problems starting from B will be as hard as Div1 E and A problem will be as trivial as possible. In this case, a few reds would be distinguished from each other based on number of solved problems (one solved 2, other 3 etc). Others will be rated only based how fast they could read the statement of trivial problem A and how fast they could type a text for trivial solution for A.Of course, that would be extreme case but I hope you've got the idea.I'm not enjoying write text for trivial solution for A problem as fast as possible as it will be the only way to distinguish yourself unless you are super strong.If problems don't have huge gap in difficulty, then most participants have more options than just compete in submitting trivial solution for A as fast as possible.P.S. I couldn't solve B problem for last few rounds in a row. That's never happen with me since 2015.
•  » » » » 5 years ago, # ^ |   0 I'm not gonna argue todays contest was harder than usual, that's definitely each person's perspective and it's hard to deny that B was definitely much harder than expected. But still, everyone has the same problemset and the difficulty of other problems weren't incredibly much harder. And most importantly rating isn't decided by one contest, everyone does better in some contests than others but as long as you keep practicing in participating your rating will hopefully rise independently of the problemset.
•  » » » » » 5 years ago, # ^ |   +8 Unless you are at the level to consistently solve C problem (which is quite high level), you compete with fast typing of solution for problem A.I.e. before you fill the huge gap between sometimes solving C and always solving C, you compete in fast typing solution for trivial problem A.As I said I couldn't solve B problem for last few rounds in a row. That's never happen with me since 2015! And I didn't make pause in my training. So CodeForces indeed became harder.
•  » » » » » » 5 years ago, # ^ |   0 The other people are learning faster than you and can solve B, or maybe they can finish faster than you while solving the same problems, then why wouldn't they rank higher than you?
•  » » » » » » » 5 years ago, # ^ |   +2 I don't think you understood what I tried to explain.So let's make all problems in all rounds as hard as Div1 E. Sure results of a few people could be distinguished from each other. Do you see problem in this model?
•  » » » » » » » » 5 years ago, # ^ |   0 But that's a logical fallacy, in reality you are always at least able to solve one problem, and people who are worse than you should solve the same or less problems. I know it's harsh to lose rating just because sone people typed the trivial problem faster, but if they solved the problem faster it is obl fair that it happens.
•  » » » » » » » » » 5 years ago, # ^ |   0 Look at AtCoder. They have much better difficulty distribution than CodeForces. In fact, you don't compete there by typing solution fast because the gap between difficulty isn't high, so that a lot of participants are distinguished by number of problems they solved.
•  » » » » » » » » » 5 years ago, # ^ | ← Rev. 2 →   0 All time I like codeforces because of unusual problemsets. If you want to solve easier problems there are many places. It is not easy to create interesting problems and keep their difficulty level. If one time problem B more harder than expected, other time it can be easier. Even my rating was fall, It was interesting problem. Thanks for contest.
•  » » » » » » » » » 5 years ago, # ^ |   0 That argument still is really bad, because if there are easier problems the same will happen, instead in atcoder you have to type 3 and not 1 trivila problem. And distinguishing participants by problems solved in itself is a bad measure because with 5 problems there is at most 25 different possibilities, definitely worse ranking system.
•  » » » » » » » » » 5 years ago, # ^ |   +1 I think you don't get his argument at all. He is not talking about having 3 trivial problem, but instead have a gradual increase in difficulty. For instance, this codeforces round failed to do that as B was a little too difficult, in fact when I solve B, I thought that it wasn't suppose to be a B and should be like a C instead.(which is evident by looking at the number of AC of B and C)distinguishing participants by problems solved in itself is a bad measure because with 5 problems there is at most 25 different possibilities He is not asking to only distinguish participant by problem solved, he is just mentioning the problem that for those people with lower rating, most people will only have 1 problem solved (as the difficulty level increase too quickly), and this will make it into a contest where your standing depends more on your typing speed than actual problem solving skills.
•  » » » » » » » » » 5 years ago, # ^ |   +5 Thank you! That's exactly what I'm trying to explain!
•  » » » » » » » » » 5 years ago, # ^ |   +5 To be fair I did misrepresent the last argument and I'm sorry for that, but the initial rant was about this: P.S. It looks like CodeForces became harder. So you have to run in order to stay at the same place (run=amount of training, place=rating). And if you want to grow you have to run twice as fast. It's so demotivating! So while I agree that it can be true that the difficulty grows too fast, it is the same for everyone so as long as you learn at the same speed than the others your rating will eventually improve.
•  » » 5 years ago, # ^ |   +3 And what your going to do, every one is trying his best, if you will not do this, you will newer be better.sorry for English
 » 5 years ago, # | ← Rev. 2 →   0 Test case #33 in problem B:2 58 2 2 2 2Why the answer is YES?