### JuanMata's blog

By JuanMata, 5 years ago, ,

Hello everyone!

Codeforces Round #258 (Div. 2) will take place on July 24, 19:30 MSK. Traditionally, Div. 1 users can take part out of the competition.

The round was prepared by praveen123 and me (JuanMata). This is our second Codeforces round, and hopefully not our last.

We have tried our best to make the problem statements as clear and interesting as possible. We hope that everyone will enjoy the round. :)

Special thanks to MikeMirzayanov for creating the wonderful Polygon and Codeforces platforms, Gerald for his extensive help in problem verification and testing, and Delinur for translation of problem statements into Russian. Without their help the contest would never have seen the day.

We wish all the participants good luck and high rating. :)

UPD: It is decided to use the dynamic scoring system.

UPD: Contest is finished. You can find the editorial here. :)

UPD: Congratulations to the winners. Here are the top 8 (the only ones to solve all the problems):

UPD: Wonderful statistics by DmitriyH can be found here. :)

• +167

 » 5 years ago, # |   -7 Hey...It's time to make a Div 1 round! :)
•  » » 5 years ago, # ^ |   +6 don't worry. it will come shortly. :)
•  » » 5 years ago, # ^ |   +21 Hey algo1, It's time to stop making fake accounts
 » 5 years ago, # | ← Rev. 2 →   +19 Second time from India and third time from Indian subcontinent... :) *** Editorail of your last round (Round 251) was awesome... Hope the best for this time, too... :)
•  » » 5 years ago, # ^ |   +3 Thank you so much for your review. We will try to make it better this time :)
 » 5 years ago, # |   +1 Who is going to be the main character? Devu again? :D Good Luck
•  » » 5 years ago, # ^ |   -24 Choosing a Good Name thank you sir.
 » 5 years ago, # | ← Rev. 2 →   0 Why isn't this post on the home page too like all the other contest announcement posts? EDIT:fixed
 » 5 years ago, # |   0 Thanks, for providing the link of polygon. I was unaware of it.
•  » » 5 years ago, # ^ |   -9 You could just google it !
•  » » » 5 years ago, # ^ |   0 I was initially unaware of polygon, I only come to know about it through a blog post. I did not really know that everybody can make problems for even their own contests. polygon is quite nice :)
 » 5 years ago, # |   +4 I know JuanMata personally and I can vouch for two things.One is clear problem statements.Another is — expect buttloads of football.
•  » » 5 years ago, # ^ | ← Rev. 3 →   0 "One is clear problem statements.", this should be correct, let us hope :)."expect buttloads of football.", no, not really.Actually he is a bit busy in his google orientation. So the problems statements are written by me. Otherwise you would have been completely right :)UPD: He has some time free today and tomorrow :) So you might expect both.
•  » » 5 years ago, # ^ | ← Rev. 2 →   +7 i actually wanted this round to happen before the FIFA World Cup ended. but due to other contests in queue this was not possible. otherwise ur second point would have surely been true. :)
•  » » » 5 years ago, # ^ |   +2 I would be expecting use of certain words like "lite" and "ob"... :D
•  » » » 5 years ago, # ^ |   +1 When We See The Problemsetter is JuanMata , Then We automatically expect some soccers ;)
•  » » » » 5 years ago, # ^ |   +1 So far I knew, JuanMata is a supporter of Chelsea. But now I've realized about his craziness in football... :)
•  » » » » » 5 years ago, # ^ |   +2 i am a football fan in general, but my favorite team is Chelsea. :)
•  » » » » » 5 years ago, # ^ |   0 Juan Mata is a Player of Chelsea and Spain Football Team ! So He must support them . But , at first he is a supporter of JuanMata ;)
•  » » » » » » 5 years ago, # ^ |   +1 Juan Mata is was a player of Chelsea :(
•  » » » » » » » 5 years ago, # ^ |   0 Manchester Rule!
 » 5 years ago, # |   0 What was your first Codeforces round that you made its problem statemets?
•  » » 5 years ago, # ^ |   -7
 » 5 years ago, # |   +4 There was a notification that today codeforces will not be available during some time, can somebody please tell me the exact timings when the site will be down, I forgot to note that down :(
•  » » 5 years ago, # ^ | ← Rev. 3 →   +4 I Think it is 2:30am — 6:30am in IST as far as I remember It was 1:00am — 5:00am in MSK
•  » » 5 years ago, # ^ |   -6 will Polygon also be down during that time?
•  » » » 5 years ago, # ^ |   0 yes, it was written that polygon will also be down.
 » 5 years ago, # |   +31 why 258 is BOLD?
•  » » 5 years ago, # ^ | ← Rev. 2 →   +5 so that it is easy for you to choose name of the directory for participating in the contest :P
 » 5 years ago, # |   +3 Wa!So nice!
 » 5 years ago, # |   0 Wow, such contest, very good, but I'm too young, too simple and sometimes naive. But your contest makes me feel "EXCITED"!
•  » » 5 years ago, # ^ |   +7 i see u have created another account (SmartLovelyJuanMataAgain) for this contest. why can't you just compete (maybe unofficially) with your regular account? are u really so pathetic? o.O
•  » » » 5 years ago, # ^ |   +2 Oh, he's just my dear friend!
 » 5 years ago, # |   0 Good Luck JuanMata!!
•  » » 5 years ago, # ^ |   +14 why only JuanMata, if not full luck, you can wish some luck to me too :P
•  » » » 5 years ago, # ^ | ← Rev. 3 →   +3 Haha yeah sure. He's in same college as I am so I know him
•  » » » 5 years ago, # ^ |   0 why so :P ???
•  » » » » 5 years ago, # ^ |   +1 In this blog, I've found asking you with many WHY... why so many why ??? :P
 » 5 years ago, # |   -25 and scores??
•  » » 5 years ago, # ^ |   -15 why so many downvotes?
•  » » » 5 years ago, # ^ |   +20 That is most stupid question ever asked. And there is always someone asking it.
•  » » » » 5 years ago, # ^ |   0 :)
•  » » 5 years ago, # ^ |   0 scoring now added to OP. :)
 » 5 years ago, # | ← Rev. 13 →   +3 I like the editorials of praveen123 . They are awesome at codechef and hope here also .
 » 5 years ago, # | ← Rev. 5 →   +1 YESSSSSS another juanmata CONTESSSST!!!!^_^
 » 5 years ago, # |   0 Even though the scoring is dynamic Please can you accept my request to sort the problems in increasing order of difficulty(According to you) so that I am atleast sure of solving the first two problems and don't have to click on standings again and again to confirm which problem is the most solvable .
•  » » 5 years ago, # ^ |   0 In IOI and ACM-ICPC problems are not in increasing order of difficulty.
 » 5 years ago, # | ← Rev. 2 →   0 is it allowed to use c#?
 » 5 years ago, # | ← Rev. 2 →   -21 UPD: It is decided to use the dynamic scoring system.WHY??? :(
 » 5 years ago, # |   +6 dynamic scoring = rating drop (in my case)...but maybe this time finally :-D Never give up!
•  » » 5 years ago, # ^ |   +1 I think this contest will prove exception to " rating drop (in my case)" :)
•  » » » 5 years ago, # ^ |   0 If it really prove exception ,it will be my first time to be DIV1 let us play the game till the end and see the results :)
•  » » » » 5 years ago, # ^ |   +3 haha, same here, currently I'm a little closer to DIV I, but it can be different after the contest, good luck ;-)
•  » » » » » 5 years ago, # ^ | ← Rev. 2 →   +11 anyway whatever the results I'm happy to solve D ,I think it's my first time ,I need only 6 point for DIV1
•  » » 5 years ago, # ^ |   0 same for me, I'm too unlucky in dynamic score
 » 5 years ago, # |   0 I'm so sad when my points gone down and my name change to be green. I will be more hardly.
 » 5 years ago, # |   0 Bring it on. Our ratings shall keep going up. :)
 » 5 years ago, # | ← Rev. 2 →   0 i am a new user of codeforces can anyone help me please? what does DIV.1 and DIV.2 mean?
•  » » 5 years ago, # ^ |   +3 When You are a beginner , you are attending the contest from DIV2 . When performing good in some DIV2 contests and achieving a handsome rating(1700+) , you will be able to attend the contest from DIV1.the problems of DIV1 are harder than the problems of DIV2. Good Luck :)
 » 5 years ago, # |   0 Dynamic score is ALWAYS dramatic... Can' t adjust the contest very well... And NO new users-without-any-submissions spoil our fun again...
 » 5 years ago, # |   0 Dynamic scoring is usually not very good!
 » 5 years ago, # |   0 In fact,I'm not good at dynamic scoring system.
 » 5 years ago, # |   +4 4255 till now ,seems that we will have a long queue :)
•  » » 5 years ago, # ^ |   0 What do you mean?
•  » » » 5 years ago, # ^ |   0 I mean system test will be slow specially if writer has a strong pretests
 » 5 years ago, # |   0 I register for the contest but after that i realize i can't participate. very sad. wish all participants high rating!
 » 5 years ago, # |   -7 АААААААААААААААААААА ЕЩЕ 1 минута!!!!!!Держитесь крепче!!!!!!!!!Сейчас прокатимся!!!
 » 5 years ago, # |   0
 » 5 years ago, # | ← Rev. 2 →   +62 I didn't see the part of problem D that string is only consisted by 'a' and 'b'. In my opinion you must wrote this important part of statement in problem statement, not only in input. Btw, great contest, thank you.
•  » » 5 years ago, # ^ |   0 oh i got to know it now .... even i missed it .. but the contest was awesome .
•  » » 5 years ago, # ^ | ← Rev. 2 →   0 I didn't see it too :(
•  » » 5 years ago, # ^ |   0 i see "Each character of the string will be either 'a' or 'b'" right now after reading your comments. :))
•  » » 5 years ago, # ^ |   0 I didn't notice it too!
•  » » 5 years ago, # ^ |   +1 I noticed it after 20 minutes. What about bolding these important things ? :))
•  » » 5 years ago, # ^ |   0 What was the approach to solve problem D?
 » 5 years ago, # |   0 Problem statement should be tested more carefully before launch. Hope next time we'll not be bother
 » 5 years ago, # |   0 Hey guys , I can't see others submission even after locking my problem.This problem is from the beginning. I lock my problem , I go to standings , I double click a submission of my locked problem. then I click the submission number. But nothing happens. After contest it's just fine. But I can see during the contest;. Why?
•  » » 5 years ago, # ^ |   +1 During the contest, you can only see the codes of people in your ROOM after you lock. The way to do so is in the Room tab.
•  » » 5 years ago, # ^ |   +1 you must go to the your room, not standing.
•  » » 5 years ago, # ^ |   +1 You can see and hack only solutions of contestants in your room, so go to your room instead of standings
•  » » 5 years ago, # ^ |   0 if you want to hack others code, just go to room and double-click on the submission. but, to see another code such in regular (not in the contest time) i think you cannot do it. CMIIW.
 » 5 years ago, # |   +9 Awesome contest! Thanks, JuanMata and praveen123 :)
 » 5 years ago, # |   0 I suspect that problem B is difficult to hack, and there are small amount of hacks, but some systest fails will apear.
•  » » 5 years ago, # ^ |   +3 Got WA on Test 74 :(
•  » » » 5 years ago, # ^ |   0 I solved problem B incorrectly at 35 min. Later I tried to find mistakes, and found that tests like "3\n2 3 1" do not pass, because answer is "no", but program gives "yes\n2 3". I rewrote code, and had 10 minutes to search the same bug in codes of others, but it was difficult to understand whole long codes, and I didn't try to use this or more difficult test.
•  » » » 5 years ago, # ^ |   +3 I got WA on Test 69, because I did not take into account when n is 1 :(((
•  » » 5 years ago, # ^ |   0 507 sysfails! Initially 2187 -> later 1680 !
 » 5 years ago, # | ← Rev. 2 →   +16 Nice round. Congrats to the authors! How to solve E ?
•  » » 5 years ago, # ^ |   +1 Use Inclusion Exclusion princicple to solve the equationa[1] + a[2] + a[3] + .... + a[n] = s
•  » » » 5 years ago, # ^ |   +15 could you please explain more?
 » 5 years ago, # |   0 How was problem C supposed to be solved?
•  » » 5 years ago, # ^ |   +1 First, the condition is n%3 == 0. |Solve this system of equations : |x1-x2| = d1, |x2-x3| = d2, x1+x2+x3 = k with x1,x2,x3 is wins of team 1,2,3. Have 4 cases to solve. After check (n-k) is enough to give x1,x2,x3 to X1,X2,X3 satisfy X1=X2=X3=X.
•  » » » 5 years ago, # ^ | ← Rev. 2 →   0 5 3 0 0 0 3 3 0 0 6 4 1 0 6 3 3 0 3 3 3 2 What with sample 5? It's impossible to play only three matches and have differences three won between 1v2 and 2 won between 2v3.
•  » » » » 5 years ago, # ^ |   0 yes, after k = 3 games this situation is impossible. the information given by our friend is inconsistent (what a bad friend, spoiling the football tournament for you! :P). so the answer is no by default.
•  » » » » » 5 years ago, # ^ |   0 Thanks a lot. I just didn't know if I have to check case like this.
•  » » » 5 years ago, # ^ |   0 Thanx for explanation.I have implemented in the same way suggested by you in problem C but I am getting WA on test 4 and I am unable to determine the bug .Would you please take out your valuable time for it.Any help will be appreciated.Thank You. http://codeforces.com/contest/451/submission/7234615
•  » » » 5 years ago, # ^ |   0 Thanx for explanation.I have implemented in the same way suggested by you in problem C but I am getting WA on test 4 and I am unable to determine the bug .Would you please take out your valuable time for it.Any help will be appreciated.Thank You. http://codeforces.com/contest/451/submission/7234615
•  » » 5 years ago, # ^ | ← Rev. 2 →   0 test for d1 =  ± d1d2 =  ± d2, always checking if you can have K games with those differences. doing so, you just have to solve a system of linear equations:Δ V1 + d1 = Δ V2Δ V1 + d1 + d2 = Δ V3Δ V1 + Δ V2 + Δ V3 = N - K
•  » » » 5 years ago, # ^ |   +1 There is no d3.
•  » » 5 years ago, # ^ |   0 I used binary search on the winning value of the middle team. Firstly , I have four case ++,-+,+- and --. Now for each case I tried to figure out the configuration that would fit into k. You can see my submission ,7228843.
•  » » » 5 years ago, # ^ |   0 But it is O(T.log(N)), my algorithm is O(T)
 » 5 years ago, # |   0 Перед отправкой решения меня выкидывало из аккаунта.У кого ещё была такая же проблема?
•  » » 5 years ago, # ^ |   0 Надо поставить галочку "Запомнить на месяц" при входе
 » 5 years ago, # |   +8 Wow, such fast system test which only cost 7 minutes.
 » 5 years ago, # |   +10 System test is so fast! And I am very happy because I solved four problems in Div2 for the first time!
 » 5 years ago, # | ← Rev. 2 →   +3 Give us editorial, please
 » 5 years ago, # |   -52 worst contest that i see in my life!!!
•  » » 5 years ago, # ^ |   0 I'm sorry
 » 5 years ago, # |   0 WA on test case 67 :(
 » 5 years ago, # |   +7 I scared I will get down rating
 » 5 years ago, # |   0 congratulations TankEngineer !
 » 5 years ago, # | ← Rev. 4 →   0 Got WA on b in test 69, because I did not take into account when n is equal to 1 :(Also, what's wrong with my solution for C?
 » 5 years ago, # |   +1 The contest was great! Btw, how to solve problem D ?
•  » » 5 years ago, # ^ | ← Rev. 2 →   +9 Suppose you have found the number of odd and even palindromic substring for the first few characters of the string. For example, aabaaabb have 8 even palindromic substring and 13 odd palindromic substring. At the same time, we maintain the number of 'a's at even and odd positions, and the number of 'b's at odd and even positions respectively. In the above example, we have 2'a's at odd positions and 3'a's at even positions, while we have 2'b's at odd positions and another 'b' at even position. When we append a new character to the end of the string, we can compute the number of palindromic substring which ends with the new character. For example, if the appended character is 'a', the number of odd palindromic substring which ends with the new character will be the number of 'a's at odd positions, and the number of even palindromic substring which ends with the new 'a' will be the number of 'a's at even positions. Hence, the new string aabaaabba will have 11 (8+3) even palindromic substring and 16 (13+2+1) odd palindromic substrings (don't forget to consider the new character as a substring of length 1). There are several cases to consider depending on the parity of the position for the new character, but it is not hard to code them out.Repeat the above steps, each time appending a new character to obtain the final results. Example solution here: 7227422
•  » » » 5 years ago, # ^ |   0 I didn't notice that the substring between 2 'a' or 'b' is always a good string :( If I did, I would be violet now :(Anyway, thank you very much :D
 » 5 years ago, # |   0 too long, update rating
 » 5 years ago, # | ← Rev. 2 →   +3 Juanmata, fortunately for you, someone got 258th place, however, no one got 123th place in a round prepared partially by praveen123 If you didn't understand what I am talking about, read this comment
•  » » 5 years ago, # ^ | ← Rev. 2 →   +1 LOL. but atleast OP has got +123 votes (at the time of writing this comment). :)
 » 5 years ago, # |   0 Did anyone use Hightail for the contest ? How was the experience ?
 » 5 years ago, # |   +4 Nice Round.. Got many fun reading and thinking about the problems.. Still getting fun analyzing the errors of mine... Thank you very much.. Enjoyed the contest.. Hope we will get many more like this..... :D
•  » » 5 years ago, # ^ | ← Rev. 2 →   -9
•  » » » 5 years ago, # ^ |   +2 yeap.. i enjoyed it...
 » 5 years ago, # |   0 Gave very bad contest but still +11. So sad.:(
 » 5 years ago, # |   0 I got down rating !
 » 5 years ago, # |   +2 Thank you for the contest :) Very interesting problems.
 » 5 years ago, # | ← Rev. 2 →   +5 Unbelievable! TankEngineer solved all problems in less than half an hour!!! Congratulations)
•  » » 5 years ago, # ^ |   0 Wow!!!!!! This is unbelievable. Congrats to him.
 » 5 years ago, # |   +10 Problem D was awesome. Loved it :)
•  » » 5 years ago, # ^ |   +4 me too & it's my first time to solve D
 » 5 years ago, # |   0 Hii,In question B test case 26#5373362086 994096202 767275079 734424844 515504383why "yes 2 5" is not an answer?by applying this, the sequence below is now a sorted sequence.373362086 515504383 734424844 767275079 994096202Please tell me if I am doing something really foolish.
•  » » 5 years ago, # ^ | ← Rev. 3 →   0 yes 2 5 is the correct answer. u got WA#26 because ur code prints no.
•  » » » 5 years ago, # ^ | ← Rev. 2 →   0 Ohh, Got my mistake.thank you :)
 » 5 years ago, # |   0 In the title, why the font of "258" is Times New Roman, but not Verdana as "Codeforces Round"? :P
 » 5 years ago, # |   +2
 » 5 years ago, # | ← Rev. 2 →   0 hey... in Problem C, initial number of wins for a, b, and c are not coming to be integer values for some test cases like: -> 999999999980 258442058745 258442058715 258442058720.Please correct me if I am wrong.
•  » » 5 years ago, # ^ |   0 If n % 3 != 0, answer is "no". Because each team must have n/3 wins.
•  » » » 5 years ago, # ^ |   0 Thanks for your reply...but that was not what I asked. -_-