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 MaGaroo(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

There aren't going to be spoilers in the statements right?

Nope. Many parts of the problems are written by ourselves and are not real :)

Wrong problem statements

I guess problems will have lot of hacks. HBO, inspiration...

Star India appears to have leaked the episode online through its own website.

Thanks for your dedicated information.

:D

I'll be very disappointed though, if nobody dies, or if there are no dragons/mad kings/queens causing explosions.

Well, problem B killed everyone anyway ;)

careful what you wish for, lol

Haha, 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?

No, mostly spoilers.

my pleasure :v

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.

Very faster? Seriously?

RIP. ENGLISH

OK. Fixed. Sorry for my poor English.

I mean, is it correct way to use

very faster?Why isn't the announcement on the homepage ?

tank you Arpa. anybody know how the pdf will be published????

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

Bend the knee :-P

But mah people... :D

Bend the knee

You are too harsh on me, Aunt!

I thought you knew nothing :O

Placing Daenerys Targaryen's army(#428 B) was very painful , finally receiving WA . I hate her weird choice O:)

When one of your friend didnt watch the show.

When you're just doing the contest*

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.

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

I hope that the problems will be as short as this post :)

I hope no one will die in problem statements like it's popular in Game of Thrones))

BooHoo

DracarysValar morghulis.

Valar Dohaeris <3

Any age restrictions like ROUND ONLY FOR 18+ USERS?

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?

Rowing.

please dont ask us to bend the knee :X

I know nothing . But I am gonna participate .

It sounds interesting. Really excited for the round.

Wish that the problem statements are as short as the announcement.

I miss Tywin ;_*

Dude don't post this shitty big pictures

Interesting round :)

Am I the only one in the world who hasn't watched this series yet??? :\

no i didnt watch it too but i heard its one of the best series :)

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

cool boy

I won't be able to focus on the problems, I will be thinking what's going to happen instead.

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

## GOT_FAN

WoW GoT...excited for the problem statements.

"WHEN YOU PLAY THE GAME OF THRONES, YOU WIN OR YOU DIE."

Snapdragon has beaten tourist in GCJ World Finals. He's the new king of seven kingdoms.

The long input file result hasn't been calculated yet

And the Andals, and First Men. Protector of the realm...

UPD: Tourist won it in system testing.

king in the north remains, long long live the king!!

There is only one true king !

i know nothing jonsnow;(

probably worst round ever as it is related with got

Dracarys!! :D

is it rated ?

Ahh the dreaded comment ! :D

We get such kind of comment in every announcement..

ayush_5148 you are not eligible for this contest

Game of Thrones + Codeforces = Game oftouristhaHaa

Verrrrrrrrrrrrrrrrry funny :/

HAHAHAHAHAHAHHAHA :|

Hah can't understand why those kids find it funny

When does the contest starts?

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.

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.

Best coder throne currently occupied by tourist :D

I hope that I'll perform better than Lanisters' army in last battle.

Hope there will be Emilia Clarke's nude pictures in statements

Is there any PDF for translation statements to Persian ?

smahdavi4 MaGaroo

Unfortunately, it isn't possible to publish the persian statements, we are sorry to persian users.

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

Since this contest has a lot of GoT hype, I'm sharing this with whoever hasn't seen it.

haha...nice one

I hope that this round will be successful. Good luck for everyone!

I Think I am the only one who

haven't watched this movie.. !! :Dno one has! XD

Scoring distribution

Registered users: 10157591, 172340, 10157591, 172340, 1040865060, ...

Hmm, that's suspicious...

蛤？

About to start, Good luck everyone! I wish you all High rating!

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.

what the test case 7 ?

Test-1

2 3 1 2

She 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 2but the author says 2 days !

Two unclear problem statements? Great contest. :D

This was one of the worst codeforces rounds ever.

Wouldn't qualify it as "worst." But it definitely was kind of rough

Saying this because you couldn't solve a tricky problem won't change anything

Pretests 7 in B and 5 in C;

Solutions for problem B of even reds failed in pretest 7.

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?Just used float instead of double and got AC -_-. What the hell happened in C?

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

A bit more productive version: "But I will find you and I will solve you"

That pretest 7 in B killed me

I think the judge solution maybe wrong for B. I did a hack using following test case:

4 13

2 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]

Use formatting

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.

My program finds the solution in this case :)

Really? It's terrible.

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 -

placedseat.Now there are 3 "4 -

placed" seats and 4 pairs of solders.You cannot place them without breaking the rule.

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

You need to put 2 spaces in the end and it will split the text into lines.

thanks

Now it looks like even Um_nik will fail (submission 29384447)

i think i had a very simple sol before:

Solutionis it correct??

I was wrong, see below.

1 4 2 2 2 2

It should output NO.

I hacked 4 users with this test, but I didn't understand why?

Problem B _/_

Hack for B:

1 4 1 1 2 2

Yes right?

Yes, yes

I think many will fail B after the full judging

Ehh, I fail this one too...

Hack Cases for A and B ?

Hacks for B?

I didn't hack anyone but this test broke my first pretests-passing submission:

4 10

2 2 2 3 3 3 3 3 3 3

Answer should be no I believe.

Ideas for E please, TIA.

What I did was finding the maximal component where each vertex has degree equal to or more than i (1<=i<n) but I get WA on test 5

Find the maximum clique in the graph. Suppose it has

tnodes, the result is .Can you please explain this?

This may help you . http://mathworld.wolfram.com/TuransTheorem.html

I used greedy in B, take seats in the middle segment first. Hope it pass

I think this should fail:

1 3

2 2 4

For E , is it correct that optimal answer is always a Clique?

We might have the same idea. Run under timelimit, hope that it converge. :)

I was thinking in lagrange multipliers, what do you mean by clique? is a pentagon ABCDE with a triangle ACE a counterexample?

for pentagon answer is while for triangle answer is so clique works better.

I understand that bigger clique is better than smaller, but can you explain why clique is always the best ?

this is just a guess , i have no proof.

Yes. Consider solution that distributes

x_{i}liquid to vertexv_{i}. Suppose there is no edge betweenv_{i}andv_{j}. If we fixt=x_{i}+x_{j}and changex_{i}, then answer is linear function ofx_{i}(because only summand that is could be not linear ofx_{i}isa_{ij}·x_{i}·(t-x_{i}) =a_{ij}·x_{i}·x_{j}, which is zero). So in one of optimal solutions eitherx_{i}= 0, eitherx_{j}= 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.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.

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

How would you organize it so that it's yes? I can't think of a way.

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.

1 1 | 2 2 . 10 | 3 3

4 4 | 5 5 . 10 | 6 6

7 7 | 8 8 . 10 | 9 9

The answer is definitely YES

1 1 2 2 . 10 3 3

4 4 5 5 . 10 6 6

7 7 8 8 . 10 9 9

Similar to the arrangement here

This way

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)

It's yes, ofc

My solution passed pretests and it gives YES

UPD: 29391756 passed systests =)Mine passed with outputing NO, but I tried to hack someone with this case, and it went unsuccessful, because judge outputs NO too.

yes the answer should be YES

Ideas for D?

iterate over the GCD from 1 to 1000000 and find the answer exactly for that gcd and add it to the final answer.

Inclusion/Exclusion + DP.

My code: http://ideone.com/BG4EtW

Now that the contest is over, can anyone share how they passed test case 5 in problem C? :'(

you need to calculate sum( probability of reaching the leaf * depth[leaf]), instead of sum( of paths to leafs) / number of paths

Ohhh... I can't believe I didn't realize something so simple hahaha

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.

Getting to different ends in the tree have different probabilities.

Consider the input

Getting to 2 have probability = 0.5 whereas getting to 4 and 5 have probability = 0.25 each

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.

*misunderstand

U nailed it brother!@kapslocker

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 7

but STD output "NO" ????????

We need to find summation of 1.kC1 + 2*kC2 + 3*kC3 + .... k*kCk for D right ?

I did that and some inclusion exclusion but have WA4, in any case that sum is k*2

^{k-1}Yes, then apply Pinex not to count twice some sets {6} in the example 2,3,6.

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

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)

I don't know that and had to derive a formula in last few mins and i couldn't.

I derived it in this way -> Binomial expansion is,

Derivating on both sides with respect to

x,Substituting

x= 1 on both sides,Or you could reverse the series S and add it to itself. You get 2*S = n*(sigma(nCi))

Can you please tell me how to get this formula?

WA in A,B,C. solution for C: sum over depths of leaves/ number of leafs. Cant wait to see which mistakes I made.

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.

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.

Thank you sir! I didnt even realise you need to care about that.

fuck u -> precision coz it fucked up my rating.

Is this in problem C?

yeah

In problem B, why is this white line here? I thought the seats 4 and 5 are not neighbours... :/

So {1, 2} and {7, 8} are not neighbours as well... :/

even I thought that.

As it is just a div2 B it has to be under estimated :P

How to solve C ? Also , any idea on what could be the 4th pretest ?

2 2 1

answer is 1 ,right ?

ofc, you just need to make directed graph, not non-directed as I did. After doing this, I've got WA on 5th test...

Problem B: add this test case in system tests please: 1 4 2 1 2 2

Most times they add all successful hack cases to system tests.

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.

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.

the answer is "YES".

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.

What was your idea for a root changing algorithm?

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?

Just because it's undefined does not imply it's wrong. I guess he was just very lucky!

statement says a_i>=1 , you should have gotten invalid input for a_i = 0

My mistake, my hack actually had a_i=1.

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 ?

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.

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 ?

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

3 and 6 are not neighbors

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.

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

I support your opinion. Time is invaluable in Codeforces Rounds. This contest should be UNRATED!

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.

KAN

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.

How you are affected by this issue as I see you never tried to hack any solution nor your solution got hacked

I do. The hack ID is 341785. It was unsuccessful during the contest. And it was Ignored after the contest.

You are right pantw:)

I think i should have a good sleep .

Gn

"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

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

first go and learn to spell properly..there is a huge difference b/w "quite & quiet" kiddo

It's not grammar mistake, I just mixed two letters, anyway,

if my English is bad, so I can't write anything?

peace bro..i wrote what i felt ..valar morghulis

take your well-deserved upvote, sir

Why are the system tests taking so long?

I think they are checking the std of B.

I don't know if it is kinda template or not but this two codes are same:

http://codeforces.com/contest/839/submission/29409014

http://codeforces.com/contest/839/submission/29406327

Their solutions to A also has a more or less line-by-line correspondence.

Oohoo, minimum number of days must be minimum number of index problem A, I think many contestant lost time on problem A !!!! LOL

Are there tests that cause a stack overflow in Java for C? Cause I resubmitted with iterative DFS just to make sure...

Yeah my solution just crashed on the max case. Guess it's failing system tests.

Can you share some information about the hacks that helped to identify the bugs???

`10 3 2 2 2 2 2 2 2 2 2 3`

Answer is YES, judge outputs NO. I tried to hack with it, and got unsuccesful.

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

1 2

1 3

2 4

2 5

Remember, there is a different probability that the horse ends up at cities 4 and 5 than the probability that he ends up at 3.

Thanks a lot... i didn't consider the probability of going to one branch.

Wikipedia reference was added to problem C statement without an announcement !

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.

codeforces should choose problem setters well or at least test problems many times by different persons

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?

Agree ,really bad case-bash problem.

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.

But it's unfair for the participants who solved it with the

totally correct solution.Right. But it's better than unrating this whole contest. I actually don't know and I'm fine with both.

I guess both sides will be satisfied by that.

KAN what dafuq are you doing now?

Maybe working together with the setters, and testers to figure out what will they do. They need time for that.

hack for B

2 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?

I think claris got it right. You could actually use his solution to test.

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"…

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?

it is yes. [1][1] [2][2][][3] [4][4] [5][5] [6][6][][3] [7][7]

sorry that I am wrong… and thanks a lot.

I used Hightail today for the first time. It worked nicely. Thanks to the maker(s).

Could you explain more about it???

It's an application that helps you to check sample cases for your program. Please go through this blog about Hightail for details.

Tanks

finally the testing started

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

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.

That isn't but this is.

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 ?

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.

If round 421 ended unrated,I don't see why will this round be different.Please don't apply double standards KAN

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.

Even though the system test began, my hack still shows unsuccessful, when it should be successful.

my reaction after reading "we are going to rejudge some of the hacks"

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.

So will the hacking data be in the system test?

"negative

ragingchange" I had a positive raging change after this contest :)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.

when you publish ratings ?

KAN

This issue effected on me too, or I'm not rigth, KAN can you explain me what happened!

UPD:Thanxthey ignored all my hacks, and what does it mean??

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

No just 2 or 3 of them were correct, other were incorrect, don't unswer if you don't know the unswer of question!!!

wow cool problemset (no)

wow! 1800 pretest passed for B and just 300 accepts !!!

I am worried with tests for the problem D. Is 29406336 supposed to pass?

Why should it not pass?

Calculation of the (1*C(n,1)+2*C(n,2)+...n*C(n,n)) requires O(n) time

But sum of frequencies is N, right?

No

A number from input adds to fcnt[i] only when i is divisor of the number

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

Wow, absolutely. I haven't thought about that.

Thanks

Contest should be unrated asincorrectly handled some test-caseforproblem B. :|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.

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.

Could smb explain me pretest 43 for problem B?

`11|22 3|44`

`55|66 3|77`

The numbers mean the groups.11 22*3 44 55 66*3 77

you can choose seat like something like up * is for empty seat

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

If I understand correctly, my answer "NO" for problem B is correct, isn't it?

11 22.3 44

55 66.3 77 (dot is for seat left) so your ans is wrong

AB CDEF GH 11 22 6 33 44 55 6 77 Hence answer will be YES

`11|22 3|44`

`55|66 3|77`

The numbers mean the groups.Thanks, It was really interesting problem

That problem was anything but interesting...

One of the unorganised and unplanned contest because of the questions!!

I downvoted this round.

Bproblem was way too hard for standardBlevel.I finally found clean solution for

Bafter contest:http://codeforces.com/contest/839/submission/29411599

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!

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.

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.

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.

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

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?

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?

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.

Look at

AtCoder. They have much better difficulty distribution than CodeForces. In fact, you don't compete there by typing solution fast becausethe gap between difficulty isn't high, so that a lot of participants are distinguished by number of problems they solved.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.

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 2

^{5}different possibilities, definitely worse ranking system.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 possibilitiesHe 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.

Thank you! That's exactly what I'm trying to explain!

To be fair I did misrepresent the last argument and I'm sorry for that, but the initial rant was about this:

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.

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

Test case #33 in problem B:

2 5

8 2 2 2 2

Why the answer is YES?

22 1111 33 44 1111 55

2.2 1.1.1.1 3.3 4.4 1.1.1.1 5.5