### Endagorion's blog

By Endagorion, 4 years ago, ,

Hello, Codeforces!

On Sunday, April 26th at 19:00 MSK the 300'th regular Codeforces Round will take place.

I would like to congratulate all Codeforces members and administration on this remarkable milestone. The platform has grown hugely in size and quality since its foundation, has hosted lots of exciting competitions, and has been providing the opportunity to everyone to hone their problem solving and algorithmic mastery. For this we thank the Codeforces platform creator MikeMirzayanov and all the Codeforces crew. Keep up the incredible job, guys!

That being said, I'm excited to announce that the problems on the jubilee three-hundredth Codeforces Round will be set by me, Mikhail Tikhomirov (Endagorion). You may remember the past rounds with my problems: #99, #109, #265, #283, and (in part) #295. I thank the Codeforces problems coordinator Max Akhmedov (Zlobober) for helping me in preparing this round, and Maria Belova Delinur for translating the statements in English. Also, special gratitude to Vladislav Isenbaev (winger), Alex Fetisov (AlexFetisov) and Pavel Kunyavskiy (PavelKunyavskiy) for testing the problemset and help with preparation.

This round will be shared for both divisions and will last two hours and a half (as you can see at the Contests page). The round will feature several ( ≥ 6) problems, varying in difficulty and topics involved. I hope that everyone will find an interesting and satisfying problem just for themselves! The scoring will be announced later.

To add up to the excitement, there are 30 exclusive Codeforces T-shirts to compete for in this round! The top 15 participants will get their T-shirts right away; another 15 will be randomly distributed among those who place in the top 300. Even if you think your chances on being the very best are weak, there are still good odds you will get a treat! =)

That's it. Mark your calendars and come back to compete for the prizes and for the fun!

UPD: there will be 8 problems. The scoring is standard (i.e. not dynamic): 500-1000-1500-1500-2000-2500-3000-3000.

UPD2. In order to choose people getting T-Shirts we will use the following python3.4 code that you can manually run in "custom invocation" tab on Codeforces. It uses an integer as a seed for random generator, this integer should be equal to the last submission number that happened during the contest.

import random
seed = int(input())
rnd = random.Random(seed)
# all contestants except top-15
contestants = list(range(16, 301))
rnd.shuffle(contestants)
tshirts = list(range(1, 16)) + contestants[:15]
for x in sorted(tshirts):
print(x)



UPD3: Thanks for participating!

The winners are:

The list of places getting the T-shirts are 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 40 46 67 75 80 102 103 144 152 161 169 198 233 243 269. The lucky participants are as follows: bmerry, Egor, Petr, rng_58, scott_wu, TooSimple, eatmore, atetubou, qwerty787788, niyaznigmatul, gs12117, W4yneb0t, izrak, zxqfl, yeputons, kcm1700 & cubelover (sharing the 40-th place, so both get a T-shirt), piob, Leo_Yu, matrix & Nerevar (sharing the 75-th place), Haghani, ACube, DemiGuo, FerranAlet, Emarci15, hlwt, Salvare001, MiraculousCoder, FatalEagle, gchebanov & nwin (sharing the 243-rd place), and Solaris (please let me know about any mistakes). Congratulations!

UPD4: At long last, the editorial is up! Enjoy, and sorry for the waiting.

Announcement of Codeforces Round #300

•
• +1212
•

 » 4 years ago, # | ← Rev. 3 →   +32 I really hope that such jubilee round will be awesome :)
 » 4 years ago, # |   +11 can't wait more!
 » 4 years ago, # |   +12 Sounds cool!
 » 4 years ago, # |   +60 May I suggest that in future rounds, the i-th ranked contestant would have 1/i chance of receiving a t-shirt. Then everyone will have a chance to win t-shirts, while the expected number of t-shirts needed/given is small!
•  » » 4 years ago, # ^ | ← Rev. 3 →   +24 The number will be about ln(n) in total which is too small.
•  » » 4 years ago, # ^ |   -40 so the winners (1/1==1) would always recieve T-shirt ?)
•  » » » 4 years ago, # ^ |   +6 Yes, of course rank 1 should get a T-Shirt.
•  » » 4 years ago, # ^ | ← Rev. 3 →   +26 I think that even though it's a small number for a contest, there are approximately 2 contests every week; therefore, it would be a lot in total. However, this idea could be applied every 10th (or something) contest.Also, some users are consistently in top-15; that's why some people would get unnecessarily many t-shirts, which would be boring even for them. A time restriction (for example, you can't win a t-shirt for 3 months after you've won one) would be great. Still, some people would get the exact t-shirt more than once, and this problem could be solved by changing t-shirt design let's say every 6 months.Apart from these, I think this is a really cool idea.
•  » » 4 years ago, # ^ |   +7 Well, I think it's not fair that e.g. 4th person gets a T-shirt while 2nd person gets nothing!
•  » » » 4 years ago, # ^ |   +50 But now it could be that the 300th gets a t-shirt while the 16th gets nothing too!
•  » » » » 4 years ago, # ^ |   +16 I didn't say that the current system is fair!
 » 4 years ago, # |   +12 Thanks MikeMirzayanov! Congratulate codeforces on last 300 raund!
•  » » 4 years ago, # ^ |   -27 Congratulations！;-)
•  » » 4 years ago, # ^ |   -15 round or raund...
 » 4 years ago, # |   -16 Looking forward to the contest!!!!!!!!
 » 4 years ago, # |   +20 After more than 1 week we have a contest :D
 » 4 years ago, # |   +18 Love CF rounds by Endagorion, the problems are interesting and challenges in the editorial are also awesome! Looking forward for that one!
 » 4 years ago, # |   +22 I hope the problems will be interesting and attractive. And, I also hope will have more participants in this contest. Because this is the contest for both divisions, so it is easy to get high ratings.
 » 4 years ago, # |   +134 when I felt that I lost the sense of life, I found codeforces and in general ACM contest, this really change my life, Get to work facebook, google, etc. not is a dream if you study algorithms and practice on codeforces in special. so far are 300 th contests, it is incredible thanks MikeMirzayanov and Endagorion!!!! good luck and have fun for everyone thank you codeforces!!!
 » 4 years ago, # |   +28 We enjoy the 300th Round in 2015, and imagine the moment that, when we have been old, we enjoy the 2015th Round together with our children — around the year 2045.
•  » » 4 years ago, # ^ |   +21 It seems it better to imagine 1024 round in the 2025:)
 » 4 years ago, # |   -39 Thanks MikeMirzayanov! :)It will be really very interesting and funny :D
 » 4 years ago, # |   -11 congratulations codeforces :).Looking forward eagerly to it.Hope I win one o em tshirts !!:)
•  » » 4 years ago, # ^ |   0 Was congratulating codeforces and expressing eagerness in order to try to win the contest and become a better programmer so bad that i got 16 Downvotes? :(
 » 4 years ago, # |   -25 I have just ended my exams and that's what I'm waiting for :Dhope not to go downrated :3
 » 4 years ago, # |   -7 my exams begins to start.such a bad luck :(
 » 4 years ago, # | ← Rev. 2 →   -34 You are beating PrinceOfPersia in Top Contributors list! What a week! A lot of changes and too bad for Petr :D
 » 4 years ago, # |   +20 How hard is the first problem expected to be? Div 1 A, Div 2 A or Div 2 B?
•  » » 4 years ago, # ^ |   0 Div2A, I guess.
 » 4 years ago, # |   -16 what is the probability for someone to win 2 T-shirts? (one being within top 15, another one randomly)
•  » » 4 years ago, # ^ |   +62 Using common sense theorem, 0, I guess.
•  » » 4 years ago, # ^ |   +21 Why is everyone worried about T-Shirt? Just be glad we have new problems to solve.
•  » » » 4 years ago, # ^ |   +67 ... as if all the existing problems have been already solved
•  » » » » 4 years ago, # ^ |   -8 Is there any question that has 0 accepted solutions ;)
•  » » » » » 4 years ago, # ^ |   +18 yes, NP-hard problems with N<=100,000
•  » » » » » » 4 years ago, # ^ |   +6 you mean N >= 100,000 right?
•  » » » » » » » 4 years ago, # ^ |   0 Can you solve NP-hard problems when N=99,999 ?
 » 4 years ago, # | ← Rev. 2 →   +55 "The round writer is Codeforces problem coordinator Endagorion. Do not miss the round!"Looks like Zlobober has lost his job... :P
•  » » 4 years ago, # ^ |   +206 Holy Dijkstra! My bad again :-( Sorry! Seems to me it's time to retire...
•  » » » 4 years ago, # ^ |   +32 Holy Dijkstra!
•  » » » 4 years ago, # ^ |   +44 Seems it's time to write automatized script with one if statement, which will generate the email.
•  » » » 4 years ago, # ^ |   0 Holly Dijktra! so funny =))
 » 4 years ago, # |   -19 I want the 300th rank!
 » 4 years ago, # | ← Rev. 4 →   -76 bavar konin yeki az dooostam kerm rikhteeee
•  » » 4 years ago, # ^ |   -25 chera amsale toye kosmaqz hameja bayad aberooye irano bebaran ?
•  » » » 4 years ago, # ^ |   -27 alowwwf goosh midiii?
 » 4 years ago, # |   +1 Currently, there are only about 3500 participants registered in this contest. It is too little in my thinking. I hope will have more, (about 5000 participants). Because this is the contest for both divisions, so it is easy to get high ratings (if have more participants).
•  » » 4 years ago, # ^ |   +10 it will be 5000 in 19.00
•  » » » 4 years ago, # ^ |   +13 18:51: There are 5014 participants abroad!
•  » » 4 years ago, # ^ | ← Rev. 2 →   0 Wow It's 5023 till now!!! The registration rate is so high during last minutes.
•  » » » 4 years ago, # ^ |   0 Cause it's so exciting to be almost late!
•  » » 4 years ago, # ^ |   +2 My dream became the trust !
 » 4 years ago, # |   +1 Mark your calendars and come back to compete for the prizes and for the fun!!! I hope the Round to be FUN like your last round #295 :D
 » 4 years ago, # | ← Rev. 5 →   -26 hope it is ratingful!
•  » » 4 years ago, # ^ | ← Rev. 2 →   -17 no reason for unrated
•  » » 4 years ago, # ^ |   0 make down
•  » » 4 years ago, # ^ |   0 why minuses??
•  » » » 4 years ago, # ^ |   0 Because no reasons for unrated?
 » 4 years ago, # |   +13 Don't want Dynamic Scoring.
 » 4 years ago, # |   -8 Обожаю когда Div1 и Div2 пишут один контест) хоть в этом контесте можно посоревноваться и с Div2 и с Div1))
 » 4 years ago, # |   -49 I hope i become master and afsh5 deader w omarhashim
•  » » 4 years ago, # ^ |   -35 Brad_bit el fahsee5 :D :D
•  » » » 4 years ago, # ^ |   -28 Dah 3abet :D :P
 » 4 years ago, # |   -35 Congrats! :DYou're now first in top contributors list.
 » 4 years ago, # |   +7 NO Iphone 6 so tourist wont participate
 » 4 years ago, # |   0 it seems that the contest will be great,good luck everyone !!
 » 4 years ago, # |   0 When registering for the round, do you need to do something more than click the register button? I clicked on it yesterday, but I can't submit anything now, because apparently I'm not registered. I suppose there is no way of registering during the competition... this is so annoying.
•  » » 4 years ago, # ^ |   +8 Yes; there are two separate registrations, one is to register for Codeforces (getting an account) which is done at the very first time before you have an account, and another is to register for each contest which is done every time before a contest starts.
 » 4 years ago, # |   0 The room link is busy most of the time during hacking(codeforces is temporarily unavailable), rest all links are working.
 » 4 years ago, # | ← Rev. 2 →   +73 Do not have to print the leading zeroes in the numbers. Don't have to means that there isn't any obligation at all,There is no need to do it.Don't have to is different from shouldn't and mustn't. So why the f#ck a solution that prints leading zeroes gets WA?
•  » » 4 years ago, # ^ |   +48 Agree. Codeforces need a proper translator.
•  » » 4 years ago, # ^ |   +30 Luckily during the round I guessed this was a translation error, but errors like these mustn't happen.
 » 4 years ago, # |   +33 The clarification of problem A was simply enough to ruin the whole contest. :)
•  » » 4 years ago, # ^ |   +19 True, with this clarification the contest went directly to hacking phase. After I got the notification I resubmitted mine solution cause I read it differently first time and then made around 13 successful hacks on all solutions in the room whose authors didn't update the code yet.
•  » » 4 years ago, # ^ | ← Rev. 3 →   +14 Why did they feel the need to resend a part of the statement as a clarification? The word substring was present in the original statement, so whoever misread it shouldn't get any extra help...Edit: The clarification was the exactly once part, not the substring part. The comment still stands, though: if they thought the statement was OK, this shouldn't have been done (and if they thought the statement was not OK, they should have changed it).
 » 4 years ago, # |   +1 What was the pretest 4 for B?
•  » » 4 years ago, # ^ |   0
•  » » » 4 years ago, # ^ |   +5 You're absolutely right, but I didn't print leading zeros.
 » 4 years ago, # |   +4 About me, there is not image to describe the problems. Too many words to be able to understand the problems.
 » 4 years ago, # |   +10 Does anyone misunderstood the problem A statement like me?
•  » » 4 years ago, # ^ |   0 Most of them did, I guess. There were so many hacks on A coz of this :P
 » 4 years ago, # |   +9 Happiness is — when Pretests pass after 8 WAs :D (I just hope I get AC)
 » 4 years ago, # |   +3 Problem D, I can't understand. Explain for me.
•  » » 4 years ago, # ^ |   0 Fill our answerxxxxx xxxxx xxoxx xxxxx xxxxxFor every cell we iterate for all figures (can all figures beat current cell). And check all crosses on table are beated.
 » 4 years ago, # |   -22 What the fuck hack on problem A was ?
•  » » 4 years ago, # ^ |   +5 Everyone thought it's "can cut out as many substrings as you want"But actually it's only allowed to cut once. (Clarification)So contest went directly to hacking, to hack people who didn't update their code yet
•  » » 4 years ago, # ^ |   +5 CODQEFORQCES
•  » » 4 years ago, # ^ |   +14 Pretests are extremely weak; most of solutions which I hacked were checking that input string contains "CODEFORCES" as a subsequence. Checking that input string contains "CODEFORCES" as a substring also passes pretests.
•  » » » 4 years ago, # ^ |   +13 Strong pretests take all the fun of it :)
•  » » » 4 years ago, # ^ | ← Rev. 2 →   +8 Checking that input string contains "CODEFORCES" as a substring also passes pretests. How does it pass the first sample test? (CODEWAITFORITFORCES)
•  » » » » 4 years ago, # ^ |   +11 Agree, my bad. Probably I understood one of hacked solutions in a wrong way.However, here is another example of what can pass pretests — 10893468. This solution doesn't even check relative order; there is only counting of occurrences for every letter. It will say YES for test SECROFEDOC.
•  » » » » 4 years ago, # ^ |   -8 Just cur CODE**WAITFORIT**FORCES
•  » » 4 years ago, # ^ |   +13 I hacked some solutions in the end of round with tests "CODEFORCESB" and "BCODEFORCES"
 » 4 years ago, # |   0 Can someone check what is wrong with this submission for problem D : http://codeforces.com/contest/538/submission/10895720It gives WA for pretest 1, and I can't find any move that violates the given input.
•  » » 4 years ago, # ^ |   0 Do you print o in the middle of the board? :)
•  » » » 4 years ago, # ^ |   0 Yes.. on Line 15
•  » » » » 4 years ago, # ^ |   0 I printed *'s in place of x's.. :/
•  » » 4 years ago, # ^ |   +8 You were supposed to print x for the moves, not *.
•  » » » 4 years ago, # ^ |   0 Yup..
 » 4 years ago, # |   +2 I will become Candidate Master. So sad
•  » » 4 years ago, # ^ |   +6 me too((
 » 4 years ago, # |   +4 How to solve Problem E ?
•  » » 4 years ago, # ^ |   0 DP over subtrees, with four cases depending on which player's turn it is and which player is allowed to rearrange the numbers in the leaves beforehand.The number that then needs to be stored for each tree is the final result if the leaves of that subtree are labelled with the numbers from 1 to msub, where msub is the count of leaves in that subtree.
•  » » » 4 years ago, # ^ |   0 Would you mind to elaborate a bit more? It's not clear to me.
•  » » » » 4 years ago, # ^ |   +20 Let's first say we are the minimizing player and also allowed to modify the labels.For the subtree rooted at i, define f(i) = k if the game on that subtree ends on the k-th smallest label among the leaves in that subtree.There are two kinds of nodes, depending on which player's turn it is. Let's call the current node i and its children j1, ..., jt.Case 1: it is our turn. Let j be the child of i with minimal value of f(j). The best solution then is to rearrange the labels in the current subtree so that all the smallest labels end up in the subtree rooted at j and make our move to j. So in this case f(i) = min(f(j1), ..., f(jn)).Case 2: it is our opponent's turn. As he wants to maximize the result, he will move to the child j where the f(j)-th smallest label is as large as possible. We need to find a rearrangement of the labels to keep that value as small as possible, and we can see that the best we can do for that label is f(j1) + ... + f(jt). For instance, we can place the f(j1) smallest labels below j1, the next f(j2) below j2, and so on. So in this case f(i) = f(j1) + ... + f(jt).Let's now say we are the maximizing player. This works in fact dually, we now only have to define f(i) = k if the game on that subtree ends on the k-th largest label instead. We can even reuse the code from the minimizing case (something I didn't notice during the contest).Code: 10900486
•  » » 4 years ago, # ^ |   +16 I figured out simplier solution: let's consider 1-st player as person we wish to win. Firsly, you can recognize, that if our palyer can get x as an answer, then he can do it for x-1.So you can use bin-search on answer. Let suppose your answer x, then all numbers >= x denote as 1, others 0. So you need to have 1 at the end in order to win. Let's calculate next value(dp): minimal number of 1's needed to win in current subtree. If this is vertex where you are to make move, your dp is just max of values of your childs. Else you value is simply sum of those values. Now the magic: we can remove bin search (which was displyed for better understanding), and replace our calculting value with something as: minimum number of large(small) numbers to win. So the answer for first would be (leafNumber + 1 - dp[root]), and dp[root] for the second.http://codeforces.ru/contest/538/submission/10897335
•  » » 4 years ago, # ^ | ← Rev. 2 →   0 DFS, for each node you compute how many leaves are there in this subtree and index of a leaf to be returned (for example there are 10 leaves and this node will return 7th of them (ordered by value)), i.e. the exact values don't matter. E.g. for MAX node with two children-leaves the result is simply 2|2; for maximizing game for MAX node with children 1|3 and 1|2 the result is 4|5.Then figure out how to combine such values for MIN/MAX nodes, it's quite easy.
•  » » » 4 years ago, # ^ |   0 I looked at your dfs code. But I can't figure out why is summing the children nodes correct for some cases? Other cases are clear though.
•  » » » » 4 years ago, # ^ |   +3 For example in maximizing game look at MIN node. Assume children have values ai|ci, that means that in a child node i the aith element will be selected. It means we can put ai - 1 smallest elements there and they will not be selected. Sum of all ai - 1 gives us number of smallest elements we can drop away. And then it does not matter where we put the next smallest number — the MIN node will choose it, that is the index of chosen node will be sum(ai - 1) + 1.
•  » » » » » 4 years ago, # ^ |   0 Thanks its clear now
 » 4 years ago, # |   0 How do you calculate which and how many numbers to use for B ?
•  » » 4 years ago, # ^ |   0 Maximum digit.
•  » » » 4 years ago, # ^ |   0 Oh, maybe I will get Wrong Answer.
•  » » 4 years ago, # ^ |   0 The maximal digit is the answer to "how many". Simply generate a number which has '1' where N has nonzero digit and '0' everywhere else, then subtract it from N. Repeat this until N becomes 0. To me, this is done easier using strings, not numbers.
 » 4 years ago, # |   0 Looks like I finally solved B 5 minutes past 12. :( But maybe Iam wrong. System tests are pending, so they won't accept my submission yet. Here is link . http://ideone.com/1Izsvr
 » 4 years ago, # |   0 when will system testing start ?
•  » » 4 years ago, # ^ |   0 Now
 » 4 years ago, # |   -114 2.5 hour its too much for 8 problem.I think 10 min it's enough to write all of them ;) Why author of problem D thinking that his problem gives us something... ,becose I know how to solve problem E(and idea for F) fuck him as my brain is fucked now by '#','o','.' symbols -_- Happy 300 Round -_-
•  » » 4 years ago, # ^ |   +6 easy man !!! calm down :D :D
•  » » 4 years ago, # ^ |   -6 I think similar to you, you are my best friend, LashaBukhnikashvili
•  » » » 4 years ago, # ^ |   0 People can't understand us,they are w8ing their t-shirts and positive ratings so dont afraid about their minuses ;)
•  » » 4 years ago, # ^ | ← Rev. 3 →   -14 aeiou
•  » » 4 years ago, # ^ |   0 Yes, problem D gave me something. I realized, that in some problems I need to output redundant "YES" before the solution itself and in some (other) problems you do not need to :) It cost me level up :) Nevertheless, I liked the contest and problems and do not feel that 2.5 was too short, first 4 problems were relatively easy, although not always well formulated :) Don't worry man, just have fun...
 » 4 years ago, # |   +39 Am i the only one who overkilled B, with a knapsack? XD
•  » » 4 years ago, # ^ |   +11 DP was used by me too.
•  » » 4 years ago, # ^ |   +1 i used bfs
 » 4 years ago, # |   +55 Note for myself: don't solve problems starting from the hardest if the contest is for both divs.
 » 4 years ago, # |   +145 F worth 2500 pts — 300 AC G,H worth 3000 pts — <10 ACAre you serious? One thing is that there were no "middle" problems, whole problemset was completely not balanced. Second thing is that point distribution was very badly adjusted. Problem with 300 AC can be worth at most 1500 pts, no matter what. If someone creates a contest with some very easy problems designed to easy Div2 problems than what he should do with Div1-type problems is to save the ratios of values of other problems, not their differences!
 » 4 years ago, # |   +47 Last submission ID was 10896731. So the T-shirt list will be: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 40 46 67 75 80 102 103 144 152 161 169 198 233 243 269 
•  » » 4 years ago, # ^ |   -10 69 is so pupular number ^_^
•  » » » 4 years ago, # ^ |   +28 I don't think so
•  » » » » 4 years ago, # ^ |   +25 Because you know nothing :D (john snow)
•  » » » » » 4 years ago, # ^ |   +17 More like because he ranked 69th.
•  » » 4 years ago, # ^ |   -9 I am on my way to become a newbie, and you care about a T-Shirt. Priorities, I guess, :(
•  » » 4 years ago, # ^ |   +9 151st
•  » » » 4 years ago, # ^ |   +16 Same here. Please disqual one person! :D
•  » » » » 4 years ago, # ^ |   0 Same T_T
•  » » » 4 years ago, # ^ |   +6 And off by one from me: ans=max(ans,h[n]+(m-x[n]-1)); What we say to CF t-shirt? Not today.
•  » » 4 years ago, # ^ |   +10 Yes, we confirm this list.
•  » » 4 years ago, # ^ | ← Rev. 2 →   +23 There are two 40th ranked contestants, cubelover and kcm1700. Will they both get a T-shirt? ;)
•  » » » 4 years ago, # ^ |   +37 Both of them will get a TShirt.
 » 4 years ago, # |   +13 Good bye Master. Good bye Orange. Good bye Stupid-Dog
•  » » 4 years ago, # ^ |   +4 hello more stupid-Dog!
•  » » 4 years ago, # ^ |   +6 Don't give up! You're not becoming gray, at least.
•  » » 4 years ago, # ^ |   0 Hey, don't do that!
 » 4 years ago, # | ← Rev. 3 →   -9 .
•  » » 4 years ago, # ^ |   -17 why 2.5 hour for 8 problems!!??.. main question,same here
 » 4 years ago, # | ← Rev. 3 →   -33 lashabuknikashvili ylea?
 » 4 years ago, # |   +53 The problem statement mentioned "cut out some substring from the banner" in the second paragraph, also from the last paragraph, "cut out of the banner some substring”. But I can't see where did the problem told us that just cut exactly one substring, at least in the English version.So could someone explain to me?
•  » » 4 years ago, # ^ |   +41 "some substring", not "some substrings" ?
•  » » » 4 years ago, # ^ |   +27 maybe "a substring" is more suitable and unambiguous than "some subtring"
 » 4 years ago, # |   +11 VERY similar problem to C was presented in TC 3 months ago: http://community.topcoder.com/stat?c=problem_statement&pm=13634&rd=16279&rm=324891&cr=23113968
•  » » 4 years ago, # ^ |   0 The Div2 version of that problem was even more similar: http://community.topcoder.com/stat?c=problem_statement&pm=13606&rd=16279&rm=&cr=40118276.Despite that, I really enjoyed this contest. Even the easy problems were interesting and well-written.
 » 4 years ago, # | ← Rev. 2 →   -90 aeiou
 » 4 years ago, # |   -11 Can somebody please help, I don't know why am I getting runtime error on problem B code here while it works perfectly on my machine.
•  » » 4 years ago, # ^ |   0 I have same problem by D
 » 4 years ago, # |   -7 in problem b 538B - Quasi Binary : in this submission 10894501 when i run the system test, the wrong test case on my machine it gives me the following:4155111 101 101 101 1here the systems says it gives 9110 100 100 100 1 1 1 1 1actually i have been all the contest trying to figure it out and i feel so angry can anybody tell me what is wrong with my code ???
•  » » 4 years ago, # ^ |   0 i too got the same thing..:(
•  » » 4 years ago, # ^ |   +21 log10(x) is a floating point function and you should never use it for integer operations.Also the function has different implementations in different systems and compilers, and will give different results and/or precision errors.
•  » » » 4 years ago, # ^ |   0 but i cast it as (int) ?
•  » » » » 4 years ago, # ^ |   +2 casting, in your case, does nothing at all because your already floored the answer.What I am saying is that, in some systems, log10(100) may be < 2 so when you take floor, it gives 1 instead of 2.
 » 4 years ago, # | ← Rev. 2 →   0 My solution for B gives correct answer on ideone while it fails on codeforces server for 4th test case.linktocodestrange!!!
 » 4 years ago, # |   0 How to solve D? I was trying to check all the possible moves for various pieces, but couldn't come up with a better logic. Any pointers for it?
•  » » 4 years ago, # ^ |   0 Yes, you essentially do a brute-force check.For each piece (o), and for each clear space (.), you can compute the difference dx, dy. And you know that dx, dy cannot be in the set of vectors. You disallow all such dx, dy (this takes O(n^4) time).Now, considering the dx, dy which are not banned, you check that each "x" is indeed attacked by some piece, i.e. for each "x", there is some "o" such that the difference is not banned.If this is true for every "x", it is possible and you output all non-banned dx, dy. If this is false, it is impossible.
 » 4 years ago, # |   0 Are the editorials out? When and where to find them?
•  » » 4 years ago, # ^ |   0 The main blog is going to be updated when the editorial comes out.
•  » » 4 years ago, # ^ |   +20 I'm terribly sorry, but the editorial will most probably not come out today. Stay tuned tomorrow, I'll update the main blog post when editorial is up.
•  » » » 4 years ago, # ^ |   0 Thanks for clarifying
 » 4 years ago, # | ← Rev. 2 →   0 In problem D in testcase 2(knight) (o..x) is invalid (I suppose we cant make this move since it forces the piece out of the board) but why in testcase 1(rook) (ox) is valid? Can anyone explain why?
•  » » 4 years ago, # ^ |   +1 "If there are several possible answers, print any of them."o..x is a perfectly valid move in the second case, but the possibility given in the samples also correctly describes the board.
•  » » » 4 years ago, # ^ |   0 Thanks! completely missed the statement that " there can be multiple answers"
 » 4 years ago, # |   +12 my dreams came true, finally I hacked a red one and became international master. Thanks Endagorion..;)
 » 4 years ago, # |   -13 My code for Probelm A fails on this testcase: MDBUW**C**ZFFZKFMJTTJFXRHTGRPRE**O**RK**D**VUXO**E**M**F**YS**O**MSQGHUKGYC**RC**VJTNDLFD**E**WF**S**My output is YES but the answer is no. Why is it no? I can cut out the substrings in between the words needed and produce CODEFORCES as i have shown above. Where does my logic fail? Is there a catch?http://codeforces.com/contest/538/submission/10898807
•  » » 4 years ago, # ^ |   0 2015-04-26 19:08:16 Announcement Problem A. Cutting BannerNote that you have to cut out the substring exactly once in this task.
•  » » » 4 years ago, # ^ | ← Rev. 2 →   -8 So I keep bruting till I find a second. If I fo find one more then no. right?
•  » » » » 4 years ago, # ^ |   -8 I grossly happened to misunderstand the question. When it said 'ONE substring', i thought 1 CORRECT substring. Not 1 wrong substring. I don't know if this was misinterpreted by someone else too but the language should have been more specific. So much for the downvotes on my comment!!
•  » » » » » 4 years ago, # ^ |   -8 I misunderstood it as well, albeit I should have read it more carefully; but yeah it got me hacked.
•  » » 4 years ago, # ^ |   -8 It was later given in announcement that you have to cut out the substring exactly once in this task.
 » 4 years ago, # |   0 Can anybody please explain why I am getting wrong answer on case 13 in C? http://codeforces.com/contest/538/submission/10891638
•  » » 4 years ago, # ^ |   +3 In the hei[i] > hei[i-1] case, you want int ans=hei[i]+(k-index[i-1])/2; instead of int ans=hei[i-1]+(k-index[i-1])/2;, i.e. you want to increment the largest of the heights instead of the smallest.
•  » » » 4 years ago, # ^ |   0 Thank you. Got it accepted after correcting this small error.
 » 4 years ago, # | ← Rev. 2 →   0 Waiting for the editorial :)
 » 4 years ago, # |   0 Can someone please tell me what is wrong with following submission of Problem — B:http://codeforces.com/contest/538/submission/10876749It says wrong answer of test case 4 which is: "415" and the output as:5 110 100 100 100 1where as on my laptop the answer is:5 111 101 101 101 1Can someone please tell? Thanks.
•  » » 4 years ago, # ^ |   0 Don't use pow for integers. Look it: http://codeforces.ru/contest/538/submission/10899576
•  » » 4 years ago, # ^ |   +5 If you change ans[i] += pow(10, cur) to ans[i] += pow(10, cur)+0.01 the solution passes as pow returns a float. Be careful with floating points — the compiler flags from Catching silly mistakes with GCC would have catched that.
•  » » 4 years ago, # ^ | ← Rev. 2 →   +6 you could write this, but it's not standard: #include #include using namespace std; using namespace __gnu_cxx; cout << power(10, 7); // this function is fast power that works in O(log n) also you can implement your multiplication function too. const int mod = (int) 1e9 + 7; struct mul { long long operator()(const long long &n1, const long long &n2) const { return (n1 * n2) % mod; } }; long long identity_element(const mul& m) { return 1LL; } cout << power(1LL, 100000, mul()); read this for more info.
•  » » 4 years ago, # ^ |   +5 Thank you guys!
 » 4 years ago, # |   +16 Problem A sample test: BOTTOMCODER :)) Is it joke ?!
•  » » 4 years ago, # ^ |   0 LOL, minion voice ))
 » 4 years ago, # |   0 For task A, one of the sample cases was DOGEFORCES. Sadly, the original image post is now down: http://codeforces.com/blog/entry/9729Does anyone have a working link?
 » 4 years ago, # | ← Rev. 10 →   +43 if (abs(notes[i].second — notes[i — 1].second > notes[i].first — notes[i — 1].first)) {cout << "IMPOSSIBLE" << endl; return 0;}I can't believe my typo in problem C passed pretests...
 » 4 years ago, # |   -11 I felt violated getting hacked on question A due to misinterpreting the question. Violated in a good way though, by all means.
 » 4 years ago, # |   0 Can anyone explain why this solution fails for E? http://codeforces.com/contest/538/submission/10901544 There are four DP cases based on whos turn it is to move and who is manipulating the game. I guess I messed up one of the cases somehow...
•  » » 4 years ago, # ^ |   +6 static int n; ... int n = sc.nextInt(); 
•  » » » 4 years ago, # ^ |   0 Wow, I'm surprised that caused WA instead of an error... Thanks!
 » 4 years ago, # |   +4 I am waiting for the tutorial in this contest (especially problem D)
 » 4 years ago, # |   +19 Maybe first time that AngryBacon wants to be at place 269 instead of 16 :)
 » 4 years ago, # |   +8 wasn't able to participate live in the contest because of a worthless college exam. looks like everyone really had fun..
 » 4 years ago, # |   0 Still waiting for editorial...
•  » » 4 years ago, # ^ |   0 And waiting.
 » 4 years ago, # |   +10 Codeforces Round #300 (with prizes(without editorial!!)!).
•  » » 4 years ago, # ^ |   +5 Finally done. Sorry for the delay.
 » 4 years ago, # |   +3 The first CF round that I couldn't solve problem A, although I spent more than 1 hour solving it :(
 » 4 years ago, # |   0 Can someone explain what problem D is about? i just dont understand what the problem is.
 » 4 years ago, # | ← Rev. 2 →   +1 I had an interesting experience with problem A. i locked and then found that my submission was wrong! So what I did was that I first hacked all those solutions which were locked so that they cant hack mine! So in the end I managed 10 successful hacks ( = + 1000 ) before my solution was judged wrong answer. I hacked 5 solutions with the same hack ( = 500 points) that would give WA on my solution as well!! It was like Counter-Strike!!
•  » » 4 years ago, # ^ |   0 BTW, It's allowed (or at least was allowed) to hack if you locked before your solution was hacked
•  » » » 4 years ago, # ^ |   -8 basically that is why i tried to hack all the locked solutions before they hacked mine. And I won! :)