Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official. ×

### 300iq's blog

By 300iq, history, 5 months ago, translation, ,

Hello everybody!

On July 28 and 30 will take place tours of EJOI — individual programming competition for juniors, held under the rules of the International Olympiad in Informatics.

EJOI consists of the most interesting and hard problems that are proposed by a wide community of authors, and that is why we decided to give you an opportunity to crack the complete problemset of the contest. During the second tour of Olympiad, we are going to conduct a rated Codeforces round based on problems of both days of our Olympiad.

We kindly ask all the community members that are going to participate in the competition to show sportsmanship by not trying to cheat in any manner, in particular, by trying to figure out problem statements from the onsite participants. If you end up knowing some of the problems of EJOI (by participating in it, from some of the onsite contestants or in any other way), please do not participate in the round. We also ask onsite contestants to not discuss problems in public. Failure to comply with any of the rules above may result in a disqualification.

The round will happen at Jul/30/2018 11:15 (Moscow time) and will last for 2.5 hours. There will be 6 problems in each division.

The tasks of the round were invented and prepared by tourist, PavelKunyavskiy, niyaznigmatul, 300iq, GlebsHP, pashka, qoo2p5, VArtem, demon1999, flyrise, ifsmirnov, isaf27, yeputons, _kun_.

Also thanks for testing grumpy_gordon, gritukan, izban, GoToCoding, Egor, dan.io, Sert, disa, alkurmtl, senek_k, BudAlNik.

And, of course, thanks to MikeMirzayanov for great systems Codeforces and Polygon.

Good luck everybody!

UPD: Congratulations to winners!

D1:

1) Um_nik

2) LHiC

3) dacin21

4) ksun48

5) Swistakk

D2:

3) IHaveHir

4) cly_none

•
• +378
•

 » 5 months ago, # |   +25 Please translate to English
•  » » » 5 months ago, # ^ |   +9 at 11:05 o'clock in Moscow time.
•  » » 5 months ago, # ^ |   +9 Sorry, it is translated now.
•  » » » 5 months ago, # ^ |   0 Thanks.
•  » » » » 5 months ago, # ^ |   -21 Your level is increasing man.
 » 5 months ago, # |   +38 When you click on EJOI, it writes no such blog entry.
•  » » 5 months ago, # ^ |   +4 Thanks, fixed.
•  » » » 5 months ago, # ^ |   0 Nice IQ(300).
 » 5 months ago, # | ← Rev. 6 →   0 23 coders are here.
 » 5 months ago, # |   +72 Wish there will be no internal errors, because... well... 500...#iykwim #okthisisabadjoke #imout
 » 5 months ago, # | ← Rev. 2 →   +14 isaf27 is among the names of this round while I_love_isaf27 is among the names of the last round :Dupd:my fault,isaf27 is also among the names of the last round
•  » » 5 months ago, # ^ |   +3 isaf27 is also among the names of the last round
 » 5 months ago, # |   +70 Congratulations everyone on the 5th century of contests here on Codeforces :) :D
•  » » 5 months ago, # ^ | ← Rev. 3 →   0 5th Century of Codeforces round, not Codeforces Contest. :)As educational rounds are also Codeforces Contest but not Codeforces round. :)
 » 5 months ago, # |   +56 Let's hope for a nice 500th anniversary!!Happy 500th round, Codeforces!!!
 » 5 months ago, # |   +236 Be scared, be very scared.
•  » » 5 months ago, # ^ |   -7 ez katka round
•  » » 5 months ago, # ^ |   -25 Registered.
• »
»
5 months ago, # ^ |
-28

### Young man. Are you eager for force?

•  » » 5 months ago, # ^ |   +18 i am not in !!
 » 5 months ago, # |   0 very excited to join a contest prepared by all of these legend.
•  » » 5 months ago, # ^ | ← Rev. 2 →   -13 DELETED
•  » » » 5 months ago, # ^ | ← Rev. 3 →   -41 DELETED
 » 5 months ago, # | ← Rev. 2 →   +13 A not bad time for Asian users :) ?Hey, maybe the contests based on OI have more unusual time which is not in evening or night? :P (Like Moscow Open Olympiad (Round #469))
•  » » 5 months ago, # ^ |   0 HAHA!You are so funny.
•  » » » 5 months ago, # ^ |   +3 I can see by your cf icon you too have refined taste.
•  » » 5 months ago, # ^ |   0 Yeah,it is so tiring to take part in contests at midnight,especially when you need to go to school tomorrow
•  » » 5 months ago, # ^ |   0 but tomorrow's div 3 will start at night again ...
 » 5 months ago, # |   +173 For those in US wondering how the hell to wake up at 4 AM, let me give you some advice:
•  » » 5 months ago, # ^ |   +3 3 AM here in Colombia :)
•  » » » 5 months ago, # ^ |   0 Well, did you follow this advice? Somehow I actually managed not to sleep, hope I can solve more than one problem :D
•  » » » » 5 months ago, # ^ |   +3 haha, no, I went early to bed. Im not sure if not to sleep is a good idea haha
 » 5 months ago, # |   0 Is it emmm, no no nothing.
 » 5 months ago, # |   +15 Should I skip my school to participate?
•  » » 5 months ago, # ^ |   0 If u can, why not?
•  » » 5 months ago, # ^ |   0 Well, I just did this in Round #469 which has the same beginning time ┑(￣ _ ￣)┍
 » 5 months ago, # | ← Rev. 2 →   -31
•  » » 5 months ago, # ^ |   +17 Херня какая-то
•  » » » 5 months ago, # ^ |   +39 Yes, I made some mistakes, sorry. Next meme gonna be better ;) ________________________________________________________Our greatest glory is not in never falling, but in rising every time we fall.
•  » » » » 5 months ago, # ^ |   +27 Don't worry, here at codeforce we like to say "practice makes perfect", whether it is segment tree or shitpost.
 » 5 months ago, # |   +8 another round with tourist's problems ... ಠ_ಠGod bless me ...
 » 5 months ago, # | ← Rev. 3 →   -8 Have now made my schedule free for Codeforces #500! <3The best feeling ever (Despite it being at 1:30 pm here, on a Monday!)
 » 5 months ago, # |   -20 I honestly expect quite a lot of people seeing EJOI Day 1's tasks from contestants, which messes with the standings by having an unfair advantage. Expecting everyone in an online competition to play fair isn't enough.Either make this contest unrated, or change Day1's tasks with original ones.Leaving such an obvious method for cheating unchecked certainly shouldn't happen for Round #500, which instead should be celebrated as a milestone in fair competitive programming.
•  » » 5 months ago, # ^ |   +148 I think that the main purpose of the contest is to solve interesting tasks, not to earn ratings. We will try to do everything to fight with cheaters, but I don't think that cheaters can ruin the contest. Just enjoy the tasks!
•  » » 5 months ago, # ^ |   +67 The onsite contestants were asked to don't disclose the problems.Anyway, there are ways to cheat in codeforces rounds even without onsite competition present. So we hope, that most people on codeforces just simply don't cheat.
•  » » 5 months ago, # ^ | ← Rev. 2 →   +72 I really like the tone of this comment, "Do this, do that, it should be". Should we also buy you a Ferrari and a nice house?I think this team of experienced contest authors together with Mike can figure something out, don't you think?
 » 5 months ago, # |   +55 300iq dude you gotta chill out. You've been included in lots of rounds recently.
•  » » 5 months ago, # ^ |   -28 Are you jealous of him??
 » 5 months ago, # |   0 I wonder if this contest would be too difficult for Div 2 contestants.... That's because actual EJOI is for pro junior coders..
•  » » 5 months ago, # ^ |   0 I think that first 2 or 3 problems won't be from the EJOI, because A, B and sometimes C are very easy and I think there aren't that easy problems on EJOI. Please correct me if I am wrong.
 » 5 months ago, # |   +7 feeling good to see tourist in problem setters...i think this contest is going to be more interesting than other contest........
 » 5 months ago, # | ← Rev. 4 →   -86 upvotes for tourist.UPD1: Now downvote for starboy_jb.UPD2: don't do anything with this comment.
•  » » 5 months ago, # ^ |   -40 downvote for sguu
•  » » » 5 months ago, # ^ |   -7 keke
 » 5 months ago, # |   -9 14 writers just for a single contest!
 » 5 months ago, # |   -37 I will miss this contest because I have to take part in HDU 2018 Multi-University Training Contest 3contest is here...
•  » » 5 months ago, # ^ |   -31 me too,hhhh!
»
5 months ago, # |
-37

# ?detaR tI sI

 » 5 months ago, # |   +181 Happy round #500
 » 5 months ago, # |   0 What controls registration time? We can register in Educational round but not in #501 yet.
 » 5 months ago, # |   -202 So many writers? Pfft. I hope this won't be disappointing. Stupid writers always disappointing. I wish you all minus rating changes. F*** y'all
 » 5 months ago, # |   +114 I hate 10 minutes delay :(
•  » » 5 months ago, # ^ |   +58 Better than long submission queues during the round.
•  » » 5 months ago, # ^ |   0 That's better than 1 hour delay,isn't it?
•  » » » 5 months ago, # ^ |   0 Not really, if you have time.
 » 5 months ago, # |   +10 10 min delay :'(
•  » » 5 months ago, # ^ |   +3 Ten minutes for dinner:(
 » 5 months ago, # |   +25 What's the score distribution?
 » 5 months ago, # |   +18 As a result of 10 minutes delay, I will miss my supper.
•  » » 5 months ago, # ^ |   0 same here, I just want to participate to contest until end of my lunch time, which means 55 minute of the contest. Now they decreased it to 45 minutes by delaying it :(
 » 5 months ago, # |   0 KIKI CHALLENGE !!!! #500
 » 5 months ago, # |   +1 After getting a %l64d error, I wasn't able to submit my code on problem A, it always said that I've submitted exactly the same code before, even if I changed things in it. I also wasn't able to ask questions on the problem.
•  » » 5 months ago, # ^ |   0 It may be caused because I registered in the 10 minutes delay time.
 » 5 months ago, # |   +12 When you solve A,B,C then leave cuz you don't have anything to do. :')
•  » » 5 months ago, # ^ |   +36 Same in div1...
 » 5 months ago, # |   -8 how to solve B?
•  » » 5 months ago, # ^ | ← Rev. 2 →   0 Answer can only be 2, 1, 0, -1.-1 and 0 are trivial.It will be 1 if (a[i] & x) != a[i] and (a[i] & x) is present in the array/set.If it's not 1, 0, or -1 then it has to be 2.
 » 5 months ago, # |   +5 I guess I'm back to div2 again... How to solve B?
•  » » 5 months ago, # ^ |   +6 Represent each row and column as a node, and connect a row and column if cell (x,y) exists. Answer is number of connected components minus one.
•  » » » 5 months ago, # ^ |   0 Thanks.
•  » » 5 months ago, # ^ | ← Rev. 3 →   +4 Make a bipartite graph (the left side of the graph is for ri and the right side is for ci, edge (ri, ci) exists if we have element (ri, ci)), then count the number of connected component.This solution works because if you will be able to make element (ri, ci) if you can reach node ci from node ri.
•  » » 5 months ago, # ^ |   +13 DSU on rows and columns. When you're given a cell, you merge the x and y coordinates. The answer is the number of components in total — 1.
•  » » » 5 months ago, # ^ |   0 szawinis Why are you doing merge(x,n+y)? A detailed explanation of your approach would be really helpful..
•  » » » » 5 months ago, # ^ |   0 Well, that's just a way of separating the x and y coordinates while keeping them in the same dsu array. Since the first n vertices are taken up by the x coordinates, we can just append all the y coordinates by doing n+y.
 » 5 months ago, # |   +5 For div1A you can prove it is always optimal to make all the x's a contiguous subarray when the ai is sorted right
•  » » 5 months ago, # ^ | ← Rev. 2 →   0 Yeah, so sliding window will work.Note that when you're doing a proof you may get stuck at one point while trying to induce a contradiction, but you should also pay attention to whether the y's form a contiguous subarray as well.If you assume that neither the x's nor the y's make a contiguous subarray, you should be able to easily induce a contradiction of the minimality.
•  » » 5 months ago, # ^ | ← Rev. 5 →   0 Yes, because you can make the x's contiguous without affecting difference between the highest and lowest y (can even decrease it), resulting in difference between the highest and lowest x being decreased (or not changed at least).
 » 5 months ago, # |   +18 How many cases are there for Div1D?
•  » » 5 months ago, # ^ | ← Rev. 2 →   0 I think 2. Update: I don't know.
 » 5 months ago, # |   +11 Div 1:
 » 5 months ago, # |   -9 I tried C with a DP approach but got WA on test 8: 40959527.Can anyone point out my mistake?
•  » » 5 months ago, # ^ |   +1 Please, explain what is d[i][j][0] and d[i][j][1] in your solution (we are not telepaths)
•  » » » 5 months ago, # ^ |   0 Alright. Should have some clarifications.In this, I declared dp[i][j] as the minimum time used to build j houses, using hills with 0-based-index not higher than i.dp[i][j][0] is the minimum time to build j houses without building a house at the i-th hill, while dp[i][j][1] is the minimum time to build j houses, including one at that hill.
•  » » » » 5 months ago, # ^ | ← Rev. 2 →   0 You need to update dp[i][j][1] with minimum of dp[ [0,i-2] ][j-1][1]
•  » » » » 5 months ago, # ^ |   +2 I haven't found the mistake yet, but I met difficulty when I was trying to solve it in your way which uses dp[i][j][0] and dp[i][j][1]. So I tried to use dp[i][j][0] ,dp[i][j][1] and dp[i][j][2]. dp[i][j][0] is the minimum time to build j houses without building a house at the i-th hill or i-1-th hill. dp[i][j][1] is the minimum time to build j houses, including one at that hill. dp[i][j][2] is the minimum time to build j houses, including one at i-1-th hill.
•  » » » » » 5 months ago, # ^ |   0 Could you please explain the transitions in your solution?
•  » » » » » » 5 months ago, # ^ | ← Rev. 2 →   +6 I omitted a dimension of the array, maybe this cause my solution hard to understand. f[i][j][0]=min(f[i-1][j][0],f[i-1][j][2])is obivious. f[i][j][1]=min(f[i-1][j-1][0]+max(0,a[i-1]-a[i]+1),f[i-1][j-1][2]+max(0,min(a[i-1],a[i-2]-1)-a[i]+1)) Transition from f[i-1][j-1][0] means that you only have to lower the height of i-1-th hill from its origin height, which costs max(0,a[i-1]-a[i]+1) hours. Transition from f[i-1][j-1][2] means that you have to lower the height of i-1-th hill from the height which had been lowered when calculating f[i-1][j-1][2] and is already min(a[i-1],a[i-2]-1), so this costs max(0,min(a[i-1],a[i-2]-1)-a[i]+1) hours. f[i][j][2]=f[i-1][j][1]+max(0,a[i]-a[i-1]+1), because there is no other choice. I finally realised my poor English when I was trying to explain my solution... Hope you can understand it.
•  » » » » » » » 5 months ago, # ^ |   0 Thank you very much!
•  » » » » 5 months ago, # ^ |   0 The first bug I see: while counting d[1][1][1] you don't consider a case when the first (0-th) hill is lowered. Can you please determine if d[i][j][1] means that you must take the i-th hill or that you can take the i-th hill?
•  » » » » » 5 months ago, # ^ |   0 Looks like I do have trouble clarifying stuffs... My apologies.dp[i][j][1] means i-th hill must be taken.
•  » » » » » » 5 months ago, # ^ | ← Rev. 3 →   0 I think the bug is this: when you take the-th hill you have to lower the next hill. But then you forget about it and don't put it in consideration when you take the d[i-2] value.You have to consider the first i hills in isolation. For example see my solution (but here 0 means that we don't count the i-th hill, and 1 means that we can count or not count it).Solution
•  » » 5 months ago, # ^ |   +6 Finally, mistake found — a stupid one I must say.i64 dp[5001][2500][2]; (It should be 2501 for the second dimension).Like, I've neglected Carrays for a very long time (only using it today since nested vectors didn't suit in 1s TL), and then this happened...Still thanks for all the support! SirRembocodina ___tutis___ ouuan
•  » » » 5 months ago, # ^ |   +5 I always use dp[5010][2510][2] in this case.
•  » » » » 5 months ago, # ^ |   0 Heck, I should spend sometimes revising Carrays again, just to have the flow in my head. Such issues are straight intolerable :D
 » 5 months ago, # |   +30 I can finally see my rating change before going to sleep as a Chinese!
•  » » 5 months ago, # ^ |   +7 And how beautiful when it is going to be a great rise.Have been monitoring your progress, and I can only say congrats! ;)
•  » » 5 months ago, # ^ |   +5 Codeforces's progress proves the revolution successful and makes itself better!^_^
•  » » 5 months ago, # ^ |   +4 Maybe I won't be able to? The rating change hasn't been shown yet.
•  » » » 5 months ago, # ^ |   +4 Now I can see the rating change.
 » 5 months ago, # |   +18 Which problems were from EJOI. The ones from Div.1?
•  » » 5 months ago, # ^ |   +34 D1 B+ were from EJOI
•  » » » 5 months ago, # ^ |   +8 Cool. Thank for the quick answear.
•  » » » 5 months ago, # ^ |   +3 Can tell us tasks by days ?
•  » » » » 5 months ago, # ^ |   0
•  » » » » » 5 months ago, # ^ |   +3 I thought, which tasks was A on first day, which one was B etc. I do not see that option on the link :)
•  » » » » » » 5 months ago, # ^ |   +13 Move your cursor on A,B,C,D,E,F.
•  » » » » » » » 5 months ago, # ^ |   0 Thanks, I am stupid :D It is interesting that there is more AC on C div 1 than on B div 1.
•  » » » » » » » » 5 months ago, # ^ | ← Rev. 2 →   0 ¯\_(ツ)_/¯
 » 5 months ago, # | ← Rev. 2 →   +46 Wow, had E coded for last 8 minutes but wifi went out I guess, and iPhone took too long to recharge so not submission :'(EDIT: :'(
•  » » 5 months ago, # ^ |   0 Cheer up T_T..
•  » » 5 months ago, # ^ |   +27 It seems that you would have won this round if this didn't happen. So sorry.But still, congratulations on becoming nutella :)
•  » » 5 months ago, # ^ |   0 Ehm, I spent some 20min going in wrong directions on E, then wasted a lot of time on D. About an hour after the contest, I decided to revisit E and figured out I can take Euler cycles in about a minute... and the rest is straightforward.
 » 5 months ago, # |   -27 My Modest Solutions
 » 5 months ago, # |   +11 Why cannot solve AB-Strings by greedy T_T...Was I missed something?
•  » » 5 months ago, # ^ |   0 How was your greedy, exactly?Also, please keep in mind that the commands with string are linear in time complexity, in case you implemented them directly on your solution.
•  » » 5 months ago, # ^ | ← Rev. 2 →   0 Yeah, I also did not understand why does not it work to just break an "ab" in one string and a "ba" in another. Though I just saw the number of OKs and the number of WAs and decided not to think further =/
•  » » 5 months ago, # ^ | ← Rev. 4 →   +23 For a test like: ababa b It's better to make the number of cuts in the two strings more equal. For example, we balance them on the very first move: ab|aba --> aba ab|a --> aa |aa --> aaa |b abb ; a|bb abbb ; a|bbb bbb 
•  » » » 5 months ago, # ^ |   +8 Oh.. I think this was it! Thanks!!so the first time pre-processing was that I was missing
•  » » » 5 months ago, # ^ |   +11 You have 6 total letters in the input data and 8 in the output, seems like you've meant: ab|aba --> ab|a --> |aa --> aaa |b a|bb a|bbb --> bbb 
•  » » » » 5 months ago, # ^ |   0 Thanks, fixed!
•  » » » » » 5 months ago, # ^ |   0 Uhm, are you sure? If you consider it correct, I don't understand the format you've chosen for it.
•  » » » » » » 5 months ago, # ^ |   0 Argh... sorry! Another try above. Yeah, now yours and mine look equal.
•  » » » » » » » 5 months ago, # ^ |   0 Okay, seems alright now, thanks for the test
 » 5 months ago, # |   0 Everyone solved D as DFS!!! I never thought of itCan someone explain it to me??
•  » » 5 months ago, # ^ |   +12 Let's present a table as bipartite graph. N vertices for rows and M for columns. Then an element means an edge in this graph. If we have a path of three edges, we can connect the ends of this path with an edge. This means that if we have a longer path a_1, a_2, a_3, ..., a_k, we can at first connect a_1 and a_4, so the path becomes shorter, and so afterwards we can connect a_1 and a_k. So if two vertices are connected, then we can draw an edge between them already. Thus we only need to buy edges to make all the graph connected, so the answer is the number of components — 1.
 » 5 months ago, # |   +2 that moment when you spend 1 Hour try solve D then you realize that you misunderstand problem because you are shit in English
 » 5 months ago, # |   +1 How to solve Div2 C? tried a lot but could not get it :(
•  » » 5 months ago, # ^ |   +1 I approached it with greedy solution — minimize one dimension of the desired rectangle as much as possible.To achieve that, we will sort 2 * n coordinates, and choose n consecutive coordinates in the new sorted array to be coordinates of the same dimension (either x or y, doesn't really matter). Technically, we'll keep a sliding window and try all possible n-length consecutive subarrays.
 » 5 months ago, # | ← Rev. 3 →   +5 I solved Div. 2 B in 16 min. but then accidently resent it after one hour and a half. Both of them are correct Which solution will be rated?
•  » » 5 months ago, # ^ |   +6 last submission will count
•  » » » 5 months ago, # ^ |   0 Are there ways to recover smh?
•  » » » » 5 months ago, # ^ |   0 sorry, i dont know about that
•  » » 5 months ago, # ^ |   0 your first solution will not be judged. It will get skipped
•  » » » 5 months ago, # ^ |   +1 It hurts. Thanks.
 » 5 months ago, # |   0 18 and 43 tests in B kills all submissions
 » 5 months ago, # |   0
 » 5 months ago, # | ← Rev. 4 →   +156 For the problem D in Div.1, Both ko_osaga (submission) and HYEA (submission) got accepted. But for the input below, ko_osaga and HYEA's outputs are different.<< INPUT >> b aabaaaaaabaabbbbaaaaabbbbaaba << ko_osaga's output >> 6 1 16 2 1 2 7 13 6 7 15 17 8 << HYEA's output >> 7 0 10 9 18 17 3 2 15 11 0 0 6 2 0 
•  » » 5 months ago, # ^ |   +29 hmm, I think it should be 6 for this case.
•  » » 5 months ago, # ^ |   +21 you should join codeforces team
•  » » 5 months ago, # ^ |   -28 My answer also has 6 actions.When a solution considers a number of cases, there can be quite a few of them (mine, for example, has a total of 18 calls to the main solution function, just to be sure). So, if one of X such cases is solved incorrectly, informally, it is X times harder to catch it with tests. So it is understandable if something like that slipped through.
•  » » » 5 months ago, # ^ |   +25 I made an identical TC in contest to test my code. It's a basic one, and if I was a tester I won't tolerate it. (But still I appreciate all setters effort!)FYI, smaller countercases : a bababab Answer is 4.
•  » » 5 months ago, # ^ |   +137 Nice.
•  » » » 5 months ago, # ^ | ← Rev. 2 →   +191 NO ITS NOT NICE
•  » » » » 5 months ago, # ^ |   -20 Very nice
•  » » » » 5 months ago, # ^ |   0 I read this in Skeletor's voice.
 » 5 months ago, # |   +22 a sudden difficulty rise between div1 C and D .Means we need code faster again
 » 5 months ago, # |   -22 Guys there was some cheating going on today. Guys like n00bie knew the questions beforehand and hence achieved a good rank. What a disgrace!
•  » » 5 months ago, # ^ |   -22 I guess I'll just repeat Jatin.Get a life.
•  » » » 5 months ago, # ^ |   -11 yeah,coz you can never be original.
 » 5 months ago, # |   +8 Can anybody tell me how to solve div1D?
•  » » 5 months ago, # ^ |   +48 Consider all substrings ab and ba: the switch positions where the two consecutive letters are not equal. Note that each cut can remove at most one switch position. Now, if we cut ...a|b... in one string and ...b|a... in the other, and swap the prefixes, we remove two switch positions simultaneously. However, one swap can remove no more than two of them, one from s and one from t.What's left to do when, for example, s has no switch positions and t has X > 0 of them? We can remove one switch position from t with one swap. But we can do better: cut the string t so that approximately half of these positions go into s. Then we can again remove two switch positions per swap, which is twice as fast.In fact, we can start by counting the number of switch positions in s and in t (let them be X > Y), and if they are not equal, make the first cut so that (X - Y) / 2 of them go from s into t, making their count approximately equal. After that, proceed with the greedy solution which removes one switch position from s and one from t in each swap.What's left is to consider which string will turn into aaa...a and which into bbb...b`, and formalizing the "approximately equal" above. We can just solve for a few  ± 1 cases and take the minimum to be sure.
•  » » » 5 months ago, # ^ |   0 Thanks a lot.
•  » » 5 months ago, # ^ |   -8 Don't. Solve E instead.Seriously, if it looks simple and there are few correct submissions, maybe the next problem will be more doable — or if it isn't, at least it won't give you a headache.
•  » » » 5 months ago, # ^ |   -11 I found E pretty easy for 2500 pointer, but D was even easier, but just tedious with implementation. For me doing E was better decision than D, but you can't simply discard such problem a priori, it wasn't that bad.
•  » » » » 5 months ago, # ^ |   0 I agree that D was easier than E idea-wise, but if the implementation is tedious enough that there are only 20 correct submissions (while 180 people attempted) in a 2.5 hour contest, and if the first correct submission came after 80 minutes... that implementation is pretty brutal. I think if D and E were swapped, there would be more correct submissions on that D than on that E.I'm not talking about discarding it a priori, but about recognising that it's not worth spending a lot of time on — either from experience, from looking at the statistics or trying it and seeing that there are a lot of cases and it's easy to miss some (so easy it happened to the authors, even).
 » 5 months ago, # |   -7 editorial?
 » 5 months ago, # |   +4 Rating should be updated now But it has been 3 hours since ending and rating haven't been updated even
•  » » 5 months ago, # ^ | ← Rev. 2 →   +29 Seems like it's not that easy this time. Like they also rolled back the rating changes for round 499.
 » 5 months ago, # |   +11 a sudden disappear of round499 rating record?
 » 5 months ago, # |   +9 whats wrong with cf 499 round??
•  » » 5 months ago, # ^ |   +8
•  » » » 5 months ago, # ^ |   0 thanks.it fixed.
 » 5 months ago, # |   +6 Is there any problem with previous round ( Round # 499 ) rating !
•  » » 5 months ago, # ^ |   +1 Problem has been fixed.
 » 5 months ago, # |   +14 Editorial?
•  » » 5 months ago, # ^ |   +6
 » 5 months ago, # |   +22 For people who came up with D in contest, how did you come up with solution to a problem like this? Did you see similar problems or did you figure it out from writing out the pairs/graphs by hand? I understand solution, but coming up with it seems like total magic to me.
•  » » 5 months ago, # ^ |   +26 Well, yes, associating rectangular grid with bipartite graph is a known thing.
•  » » » 5 months ago, # ^ | ← Rev. 2 →   -20 congratulations man. Only your hatters will downvote this comment.
•  » » 5 months ago, # ^ |   0 It makes sense that we need to have all (x,y) values in the same connected component, if all cells that we make for free are (x,y) where x is from set R and y is from set C and R is set of all x's and C is set of al y's in that component.
 » 5 months ago, # |   -10 Please downvote.
 » 5 months ago, # | ← Rev. 2 →   +1 Suddenly noticed that both the Announcement and the Editorial aren't linked to any contest...And the result is no contest materials link in the contest Dashboard or problemsetUPD: Fixed.
 » 5 months ago, # |   0 In problem B,"In one operation you can select some i (1 ≤ i ≤ n) and replace element ai with ai & x" doesn't "some i" means several i? or it just means only one i? I though that one operation can replace several i(possibly more than one i) so I got WA in test 4.
 » 5 months ago, # |   -59 The comment is hidden because of too negative feedback, click here to view it
 » 5 months ago, # |   0 Where can I find the tests to the output-only problem from EJOI?
 » 4 months ago, # |   -8 when are u going to upload editorial??
•  » » 4 months ago, # ^ |   0 The editorial existed all this time, but the link to it wasn't posted on this post. http://codeforces.com/blog/entry/60920