### xyz111's blog

By xyz111, 5 years ago, ,

Hello everyone! Codeforces Round #254 is coming soon.

In this round, there will be a really cute boy named DZY. He loves many things, we can even say everything. He has a great passion for the gorgeous world, but he can't deal with everything he's interested in. So he needs your help, and he will present rating in return.

My thanks go to Gerald, who gave me much advice and helped about the problems. And I also would like to thank MikeMirzayanov, who created such a wonderful platform.

The problem setters are fancycoder and me, and thank vfleaking, 2333333333333 and lsmll for testing.

Good luck and have fun.

UPD

In Div. 1, scores for each problem will be 500-1000-2000-2000-2500.

In Div. 2, scores for each problem will be 500-1000-1500-2000-3000.

UPD

For technical reasons, the round will be delayed by 5 minutes.

UPD

The contest is over. Thanks for participating.

Congrats the winners.

Division 1:

Division 2:

You can find editorial here

• +262

 » 5 years ago, # | ← Rev. 2 →   +51 Finally :DA contest announcement,after almost 20days.
•  » » 5 years ago, # ^ |   +3 It will have a record high of registrants! :D
•  » » » 5 years ago, # ^ |   0 We hope so.
•  » » 5 years ago, # ^ |   +3 I can't just believe that I had been waiting a month for this contest.
 » 5 years ago, # |   +1 I wish DZY to be a MERCIFUL guy ..... Everyone Good Luck and Have FUN :)
•  » » 5 years ago, # ^ |   +10 Sure, he is :)
•  » » » 5 years ago, # ^ | ← Rev. 2 →   +14 :)
 » 5 years ago, # | ← Rev. 2 →   +63 From my point of view,the problems are all very interesting.Wish you high rating!PS:DZY's CF handle is dzy493941464.
 » 5 years ago, # | ← Rev. 2 →   0 Hmmm chinese contest. Brave yourselves guys!!Actually all we need is bravery :))
•  » » 5 years ago, # ^ |   +5 Brace*
 » 5 years ago, # |   +23 Sounds great! I love cute boys (and girls)!
•  » » 5 years ago, # ^ |   -6 u love both boys and girls !!! don't confused us about your gender ;) :P
•  » » » 5 years ago, # ^ |   +24 well, some people are just too lovely...
 » 5 years ago, # |   -8 this is the contest after more half month. FUNNY ! :D
 » 5 years ago, # |   +37 the Chinese IOI team 0_0
 » 5 years ago, # | ← Rev. 2 →   +39 Brace yourselves, DZY loves desert (http://vfleaking.blog.163.com/blog/static/174807634201422485914893/) incoming...
•  » » 5 years ago, # ^ |   +25
•  » » » 5 years ago, # ^ | ← Rev. 2 →   +23 DZY loves DYNAMIC CACTUS.
•  » » 5 years ago, # ^ |   +3 20k length…
•  » » 5 years ago, # ^ |   +11 Link-Cut Cactus??? WTF! So beautiful!
•  » » 5 years ago, # ^ |   +22 omagad :O! Firstly CACTUS and secondly LINK-CUT? https://www.youtube.com/watch?v=McaV4Ua-QMA (translation ~ "exploding brain") You Chinese are really crazy :P. Hope that I won't see any cactuses in this contest :P.
 » 5 years ago, # |   +18 You had no decrease in your rating chart!
 » 5 years ago, # |   -13 I hope I will get expert in this contest http :D
 » 5 years ago, # |   0 hope the testing system will testing quick after the contest
 » 5 years ago, # |   +20 Probably won't be able to participate in the contest cause here in Bangladesh its the time for iftar(time to break fasting in the holy month of Ramadan) :( :( BTW best wishes for other participants....
•  » » 5 years ago, # ^ |   +18 That doesn't prevent you from participating you can put a lot of dates with water beside you :) and continue eating after the contest.
•  » » » 5 years ago, # ^ |   +17 Taking food is not the problem!! The important thing is magrib prayer. Besides there is Isha prayer as well as tarawih prayer which starts within one and half hour of iftar. After all its ok cause, "To get something u have to lose something". Inshallah will enjoy plenty of contests in later days :) :)
 » 5 years ago, # |   0 How to register this competition?
•  » » 5 years ago, # ^ |   0 Registration will be available after 2 Days http://codeforces.com/contests/444,445bvd
 » 5 years ago, # |   +64 hey DZY please grow up and try to solve your problems by yourself ! :)
•  » » 5 years ago, # ^ | ← Rev. 2 →   +40 but then we will not have a contest, do you want to wait more for a contest after waiting two weeks? :P
 » 5 years ago, # |   -8 please how i can register to the contest i'm new here
•  » » 5 years ago, # ^ |   0 Registration will be open in 3 hours. It always starts 24 hours before the start of the contest.
•  » » » 5 years ago, # ^ |   -6 it's now 24 hours before the start of contest, but the Contests page says that registration for the round will open in 9 more hours only.
 » 5 years ago, # |   -15 Amazing
 » 5 years ago, # |   0 Please don't use such silly names; they confuse us.
•  » » 5 years ago, # ^ |   +24 They make us dizzy.
•  » » » 5 years ago, # ^ |   0 hehehe yeahhhhhhhhh
 » 5 years ago, # |   0 Why are we having so few rounds these days? Even TopCoder has only 2 SRMS planned this month :/
•  » » 5 years ago, # ^ |   +6 Because the Chinese students in preparation for the final exam.//hahaha~
 » 5 years ago, # | ← Rev. 2 →   +3 sad its timing clashes with the timing of wimbeldon finals
•  » » 5 years ago, # ^ | ← Rev. 2 →   +5 i hope Federer wins! :) also, i hope that the Wimbledon final takes more than 2 hrs to finish, then we can watch it after contest is over :)
•  » » » 5 years ago, # ^ |   0 same here
•  » » » » 5 years ago, # ^ |   0 because of round extension by 5 minutes, maybe we can even watch the first game! ;)
•  » » » 5 years ago, # ^ |   +1 good news. only two sets are over, and both players have won one each. so we still have a long way to go! :)
•  » » » » 5 years ago, # ^ |   0 yeah ...and hope federer wins this one
 » 5 years ago, # |   +4 hey DZY take it easy !
 » 5 years ago, # | ← Rev. 3 →   +17 WARNING: Mathy round approaching!"DZY loves math xxx"
•  » » 5 years ago, # ^ |   +16 DZY loves many things, we can even say everything. so he also loves DP, probability, graphs, geometry, data structures (and many more concepts) in addition to just math. ;)
•  » » » 5 years ago, # ^ | ← Rev. 2 →   +3 It seems that my prediction was wrong :pHowever, round #255 was indeed a very mathy round :DPS: authors of round #255 is the same as "DZY loves math" series in BZOJ(a Chinese online judge contains only very tough problems)
•  » » » » 5 years ago, # ^ |   0 what round #255? u mean round #FF, right? ;)
 » 5 years ago, # | ← Rev. 2 →   +1 I don't have my library currently and my last contest was more than 2 months ago. My question is can I do it as a virtual contest during the same time as the official contest?PS: For all coders who don't have an online backup for their library, do it ASAP. My laptop's HDD crashed recently and I don't even know yet if the data can be recovered.
•  » » 5 years ago, # ^ |   0 I don't think that I notice virtual contest button appear after final system test.
 » 5 years ago, # |   -6 And, what about the unusual contest time??
 » 5 years ago, # |   +1 From the "Urban Dictionary":DZY1)Complementary definition of a person, place, or thing..that epitomizes the elements of sheik, classy, cool,or just downright unique.2) An intensifier 3) Kastration technique (????)4) Generally used to describe a very cool person 5) Nondescript term that can be used to define anything that is awesome, over the top, and dope.
•  » » 5 years ago, # ^ |   0 4) Generally used to describe a very cool personNow i understand ..
 » 5 years ago, # |   +8 There was a few consecutive contests without delay but I think it's back! Good Luck
 » 5 years ago, # |   -9 Extended by 5 minutes.!
 » 5 years ago, # | ← Rev. 2 →   0 Pretty tough competition, but great fun!I liked B a lot, though using the randomness of the simple generator felt a bit risky.Was problem A greedy somehow?
•  » » 5 years ago, # ^ |   +13 Yes; choose the edge that gives the maximum density. (The induced subgraph will have two vertices.)
•  » » » 5 years ago, # ^ | ← Rev. 5 →   +6 Oh...Because if we have already picked some nodes vs and edges es, and we want to add node u with e being the sum of edges from vs to u, then we must have (vs+c)/(es+e) > vs/es, but that implies c/e > (vs+c)/(es+e) so clearly just picking c and any node from vs would be a better choice.Thanks :D
•  » » » » 5 years ago, # ^ | ← Rev. 3 →   +3 Exactly. I went on and proved that first before submitting my solution to ensure correctness. :POf course, you have to pick the node in vs that is connected to c, but that's why you inspect each edge (instead of any pair of vertices) to ensure the connectivity.
•  » » 5 years ago, # ^ |   0 for A, we always had to choose two nodes and one edge. adding more edges will make the density lower.
 » 5 years ago, # |   0 Please can anyone tell me how to do Div2 C ?
•  » » 5 years ago, # ^ |   +3 new graph consists of 1 edge. :)
•  » » » 5 years ago, # ^ |   0 OMG I should have thought of that! :(
•  » » » 5 years ago, # ^ |   0 how to prove it's the optimal solution?
•  » » » » 5 years ago, # ^ |   0
•  » » 5 years ago, # ^ |   0 Answer is the best (x[i]+x[j])/c(i,j) where i,j are vertices
 » 5 years ago, # |   0 how to solve Div-1 B? also, why my code 7029179 gives WA#9?
•  » » 5 years ago, # ^ | ← Rev. 2 →   -6 del
 » 5 years ago, # |   0 Problem E uses Inteval Tree (Segment Tree) ?
•  » » 5 years ago, # ^ |   0 Yes :D
 » 5 years ago, # |   0 Oh God, a stupid mistake, in problems B div 1 I use ios::sync_with_stdio(false) but then I use print("%d"). May my code will fail system test because that mistake ?
•  » » 5 years ago, # ^ |   0 nope
•  » » 5 years ago, # ^ |   0 No, if you used only printf
 » 5 years ago, # |   -6 Contest is difficulty with me !
 » 5 years ago, # |   0 How solved problem B ?
•  » » 5 years ago, # ^ |   +6 Put chemicals in order of DFS then caculate danger. I learnt to code DFS when contest is running LOL.
 » 5 years ago, # |   0 Fast system :D
 » 5 years ago, # | ← Rev. 3 →   0 Good Contest ... Thanks Authors ...Segment Tree range updates in problem E/Div2 C/Div1 was very similar to UVA12436 if(l<=x<=r) You need to find where updates is zero ... Then you have one A query and one B query else You have one query like UVA-12436 A or B and one value update on segment-tree UPD : ok ok ... DownVoters i got ... in case colors was fixed this kind of solution would be correct , but in this problem, it wont work ... I hope some days we only DownVote to rude speeches, NOT WRONG IDEAs
 » 5 years ago, # |   +9 Very quickly system testing :D
 » 5 years ago, # |   +8 very fast system testing! :)
 » 5 years ago, # | ← Rev. 4 →   0 I liked the round a lot. C was super nice , I solved it on paper with sets and an segment tree. ( but I'm not sure it's ok ) I got WA on B for something that I thought it works in O(N log N) , but got TLE. Overall , very nice round even though I think I'm going to be div2 after it. :)) Congrats for the authors !
 » 5 years ago, # |   +3 Definitely, fastest system test!
 » 5 years ago, # |   +13 Following my previous blog post on ranking submissions as a collaborative wisdom for picking good reference solutions, i.e. http://codeforces.com/blog/entry/12917, you can now vote your favourite submissions for this contest at:
 » 5 years ago, # |   +63 Damn it. One character and I'm the first: - if (sz(it1->second) < sz(it2->second)) swap(...) + if (sz(it1->second) > sz(it2->second)) swap(...) What's even more painful is that I wrote right at first, then changed it for testing purposes and then forget to change it back.
 » 5 years ago, # |   +35 This bug has costed me 100 points.I have clicked once submit.
 » 5 years ago, # |   +6 I wrote lots of code for C(div 2). Than I recognized we just need two nodes and an edge. :(
 » 5 years ago, # |   0 My code got wrong answer on pretest 5 div2 A. I see the test case but I think my output is also correct. Can someone check it for me please? http://codeforces.com/contest/445/submission/7032620
•  » » 5 years ago, # ^ |   0 On the second line of your output, you have two B's next to each other.
•  » » » 5 years ago, # ^ |   0 Oh I see. Thanks
•  » » » » 5 years ago, # ^ |   0 Next time you should take a look at checker comment before asking such questions
•  » » » » » 5 years ago, # ^ |   0 I did but I was such in a hurry to find the wrong one and angry because of not being accepted, so I didn't see it. You're right. Thanks for your advice
•  » » 5 years ago, # ^ |   0 the fourth last line, the last two characters are the same.
•  » » 5 years ago, # ^ |   0 "wrong answer Two same chessmen stand in adjacent cells 2, 27 and 2,28" . Check those places, BB occurring there.
 » 5 years ago, # |   0 will there be any solutions posted?
•  » » 5 years ago, # ^ | ← Rev. 4 →   +1 Editorial will be posted very soon. BTW,the contestants' solution for Div1 E was unexpected to us...Our solution was far more slower,that's why n is only 3000
 » 5 years ago, # |   0 Anyone who tried to exploit the random generator in 1B? Many solutions (including mine) depends on randomness. Problem statement blocked the unique fixed point, but there might be some small cycle which can hack these kinds of solutions.
•  » » 5 years ago, # ^ |   0 Our intended solution do depend on randomness,so we blocked that number.
•  » » » 5 years ago, # ^ |   0 Is there any solution for arbitrary permutations (better than straightforward n^2)?
•  » » » » 5 years ago, # ^ | ← Rev. 2 →   0 Check it out in another thread
•  » » 5 years ago, # ^ |   0 Oops, I forgot people might try to hack that. I was relying on the problem setters being nice :-)If there is a 1-cycle, probably there are also cycles of most other lengths?
•  » » » 5 years ago, # ^ |   +3 No, there are one 1000000006-cycle and one 1-cycle.Seems like authors considered such hack :-
•  » » » » 5 years ago, # ^ |   +3 Any proof for that?
•  » » » » » 5 years ago, # ^ |   +3 1e9+7 mean nothing, brute it.I don't know if % (i + 1) could help create some "cool" sequence, likely not.
•  » » 5 years ago, # ^ |   +8 You can get the explicit formula of this sequence, and you will find 37 is the primitive root of 10^9+7, so the cycle's length is 10^9+6.
•  » » » 5 years ago, # ^ |   0 This is very interesting. So actually the 10007 term was unnecessary and nearly half of all numbers less than 10^9+7 would have worked as factors. At least these would all have given a 10^9+6 cycle.http://mathworld.wolfram.com/PrimitiveRoot.html
 » 5 years ago, # |   +5 How to get on the main page after the contest without actually participating. =)
 » 5 years ago, # | ← Rev. 2 →   0 I have used 4 Segment tree to get AC problem C (after the contest). Does anyone have better solution? Thank you.
 » 5 years ago, # |   0 waiting for editorials...
 » 5 years ago, # |   -11 How to solve div2D? FFT?
 » 5 years ago, # |   0 A Div2 was harder than a usual A Div2
 » 5 years ago, # |   0 English Editorial has been posted!
 » 5 years ago, # | ← Rev. 4 →   0 interesting problem set, I wrote complicated solutions for C and E, and got very simple solutions after reading subscriber's code, cool!3 bytes far from all clear orz. - s+=(r-l+1)*abs(x-vq.back()); + s+=(r-l+1LL)*abs(x-vq.back());  - int l=1,r=10000; + int l=0,r=10000; 
 » 5 years ago, # | ← Rev. 3 →   +8 Very nice round. I liked the problems even though i only managed to solve 1. Div. 1 A proved to be a nice revelation. I got the idea by thinking back to when i used to play online shooters when I wanted to maximize my kdr (Kill-Death Ratio). Say my current kdr was K/D and in a match i'd manage to get k kills and d deaths. Now if k/d > K/D then (K+k)/(D+d) > K/D and my kdr would grow or it would fall otherwise. The same thing applies to the problem at hand.
 » 5 years ago, # |   -8 The TIme limit for problem C should have been 3s. My algo was correct (used sqrt-decomposition) but I had to reduce the size of each partition by a constant amount to get it accepted.
•  » » 5 years ago, # ^ |   +26 What's the problem then? It's absolutely OK that some implementation details matter a lot, imho.
 » 5 years ago, # |   +7 You can see the country wise standings for the contest here. In case you want to report bugs / suggest features, kindly use this blog.
 » 5 years ago, # |   +3
 » 5 years ago, # |   +13 Div1-B can be solved without regard to randomness in time. See 7031500
•  » » 5 years ago, # ^ |   +8 I'm curious why do you use integers in your BitSet? For example my implementation with longs 7040099 works like 1.5 times faster than same with ints 7040106.
•  » » 5 years ago, # ^ |   -24 It seems to me that and O(n2) are same, therefore there is no reason to write 32 in the denominator.
•  » » » 5 years ago, # ^ |   +5 Formally, they are, but in this case, the /32 factor is used to denote that the constant factor will be that much smaller.
•  » » » 5 years ago, # ^ |   +29 Still my notation leads to a little bit better understanding of actual solution timing, isn't it?
 » 5 years ago, # |   0 How to solve div1 C using segment tree ?