### albertg's blog

By albertg, 6 years ago, translation,

Hi!

On 3rd December, 18:00 at Moscow will be Codeforces Round #281 (Div. 2). As usual Div. 1 contestants can take part out of contest.

This is my first Codeforces Round and I hope that this isn't the last one :)

Thanks to Maksim Akhmedov (Zlobober) for the help in making contest and MikeMirzayanov for Codeforces and Polygon platforms.

UPD1: The scoring will be dynamic.

UPD2: Contest is over. Thank to all participants. I hope you liked my contest.

UPD3: Editorial

UPD4 Top-5 contestants, congrats

Also congrats to gaoyihan, who solved problem E.

UPD5 Hack stats by illi.

• +127

 » 6 years ago, # |   -13 Fixed :D
 » 6 years ago, # |   -16 you must be confused
 » 6 years ago, # |   -12 Tow blog ? why?
 » 6 years ago, # |   +5 Wow, what an intriguing round number; 281 is the sum of the first fourteen primes!
•  » » 6 years ago, # ^ |   +5 Yes... And its sum of digits is a prime really interesting
•  » » » 6 years ago, # ^ | ← Rev. 2 →   +36 1! + 3! + 4! + 5! + ... + 281! is also prime
•  » » » » 6 years ago, # ^ |   0 That is interesting XD
•  » » » » 6 years ago, # ^ | ← Rev. 5 →   +10 281 is Sophie Germain Prime281 twin prime with 283281 is Chen Prime281 is Eisenstein primeAlso281=5^2+16^2281^2=160^2+231^2
•  » » » » » 6 years ago, # ^ |   +8 i sense wolfram alpha
•  » » » » » » 6 years ago, # ^ |   +11 no wiki
•  » » » 6 years ago, # ^ |   +2 hahahaha really interesting :D
•  » » » 6 years ago, # ^ |   +4 We shouldnt forget that 281 itself is a prime (nobody actually pointed that out)
•  » » 6 years ago, # ^ |   -21 and its number of ones in base 2 is a square such an interesting number
•  » » » 6 years ago, # ^ | ← Rev. 2 →   +233 this number also represent the area of a square with side length it is also the 281st natural number.it also can be written as sum of two numbers! also you can notice that if you added 5 to this number then subtract 5 it will back to the same number 281 !!! What a magic !WOW the number 281 has a lot of nice properties which make it very interesting number! this is impressing!!I feel this round will be very special because of this number!!
•  » » » » 6 years ago, # ^ |   +57
•  » » » » 6 years ago, # ^ |   -39 Wow, I also noticed that 281 is either an interesting number, or the first non-interesting number, by induction!!
•  » » » » » 6 years ago, # ^ |   +5 You mean pigeonhole principle?
•  » » » » » 6 years ago, # ^ |   0 haahahhahhaaha wooou
•  » » » » » 6 years ago, # ^ |   -6 Please explain why inudction work for this for bad math skill like me
•  » » » » 6 years ago, # ^ |   +31 That's why you are the king of numbers :p
•  » » » » 6 years ago, # ^ | ← Rev. 2 →   +9 You are exactly the King of Numbers. You know a lot of special things about numbers :DP/s: HIdenoriS was a bit faster :(
•  » » » » 6 years ago, # ^ |   0 u cant find so much thing for 282
•  » » » » 6 years ago, # ^ |   0 Someone wanted Codeforces div.3 to appear. I think I could compose some problems using this amazing piece of enlightenment: 1. Given a square side length, which is represented as square root of the some natural number, write the area of given square. 2. Given an array of numbers, where each array element equals to its index, write a 281th element of array. 3. You are given an interesting number 281. Each test case contains a number X. You should know that when you subtract number X from 281 and later add X to that result, you have the same number — 281! But you are to test vice versa. You firstly try to add number X, and only later you subtract number X. If you gain number 281 output "I've found 281 has an amazing property!", otherwise: "I still need to learn some math basics". 4. Output three numbers: two numbers which sum equals to number 281, and third number: base that represents these two numbers. Be careful! Both numbers which sum equals to 281, must have the same property, that thay can be composed of two other numbers.
•  » » 6 years ago, # ^ |   +51 Also 281 = 9*8 + 7*6 + 5*4 + 3*2 + 1 + 2*3 + 4*5 + 6*7 + 8*9 
•  » » » 6 years ago, # ^ |   +1 Also 281 = 281 + x * 0, x — any number
•  » » » » 6 years ago, # ^ |   -7 281 = 281 — 1 + 1
•  » » » » » 6 years ago, # ^ |   +10 ......
 » 6 years ago, # |   +23 Hope short and simple problem description just like the announcement :)
•  » » 6 years ago, # ^ |   0 Also hope to see a nice problem-set and rating growth..
 » 6 years ago, # |   +9 This contest's registration will be end 30 minut before the contest Be careful!!!
 » 6 years ago, # |   0 Good time for Asian participants :)
 » 6 years ago, # |   -40 PLZ unlike me :))))) PPPPLLLLLZZZZ
 » 6 years ago, # |   -12 Hope to get +111 to be Blue.........
 » 6 years ago, # |   0 I am feeling ill.
 » 6 years ago, # | ← Rev. 3 →   -13 Hope more than 4000 contestants.All the fighters fight each other. Happy Coding.
 » 6 years ago, # |   0 Hello Every BodyI Love Codeforces <3
 » 6 years ago, # |   -42 I want unlike plz unlike me (:
 » 6 years ago, # |   -8 yes,4000 up.Really interesting.....281
 » 6 years ago, # | ← Rev. 3 →   +3 Dynamic scoring and 4000+ contestants?! Lets hope that the testing system wont crash. Good luck everyone and to a higher rating!
 » 6 years ago, # |   0 What does dynamic scoring mean?
•  » » 6 years ago, # ^ |   +3
•  » » » 6 years ago, # ^ |   0 Thank you! :)
•  » » 6 years ago, # ^ |   +1 for me dynamic scoring means low rate :(
 » 6 years ago, # |   0 Good luck everyone !
 » 6 years ago, # |   +16
 » 6 years ago, # |   0 what does locking a problem do???
•  » » 6 years ago, # ^ |   +1 to be able to hack others solution in your own room
 » 6 years ago, # |   0 Hacks and Hacks in Problem B. I didn't see such amount of Hacks in a problem.
•  » » 6 years ago, # ^ |   0 Many people forgot to implement all the conditions to break the ties and decide a winner. I got 2 good hacks with the case:2 -1 1or2 1 -1
 » 6 years ago, # |   +1 Guess what -33 submissions on E and growing ... solving E isnt worth a penny anymore its score will be like 150 to me...
 » 6 years ago, # |   +77 Sweet, sweet revenge :)
 » 6 years ago, # |   +13 Good bye blue color see you again :(
•  » » 6 years ago, # ^ |   +19
 » 6 years ago, # |   0 This feeling...
 » 6 years ago, # |   +9 So, what were the horrible tests at B? It seemed pretty simple to me and my solution wasn't hacked but boy, there were tons of hacks. So any specific corner cases?
•  » » 6 years ago, # ^ |   0 overflow?
•  » » » 6 years ago, # ^ |   -7 Well, I'm impressed by the amount of overflows then :D
•  » » 6 years ago, # ^ | ← Rev. 2 →   0 Overflow on a test like this: 3 1000000000 1000000000 1000000000 
•  » » 6 years ago, # ^ |   0 Probably overflow in sum calculation?
•  » » 6 years ago, # ^ |   0 I managed to hack two solutions with 4 1 5 -2 -4 because lexicographic comparison wasn't implemented correctly.
•  » » 6 years ago, # ^ |   0 Many people forgot to implement all the conditions to break the ties and decide a winner. I got 2 good hacks with the case:2 -1 1or2 1 -1
•  » » 6 years ago, # ^ | ← Rev. 3 →   0 Participants tried to concatenate two strings and compare them lexicographically. So for example I hacked with that test: 4 11 1 -9 -3 11 > 9 => true, but 111 gt 93 => false
 » 6 years ago, # |   +3 How to solve E ?
•  » » 6 years ago, # ^ |   +9 Firstly, from P(t) = a, you should notice that sum of all coefficients of P(x) should not larger than a. Secondly, from P(a) = b, you can find the minimum of sum(noted as S) of all coefficients occur when you decompose b into base a and all coefficients are smaller than a. And for other type of decomposition of b, the sum of all coefficients will be at least S+a-1. So when S>1, you only need to check the decomposition of b with minimum sum of coefficients. And discuss special case when S=1.
•  » » » 6 years ago, # ^ |   +5 Oh, that's a cool solution, I was sure it'd be some difficult math on polynomials, but it seems like it was easier than expected.And wow, aren't you unlucky to fail E because of one line of code :P
 » 6 years ago, # | ← Rev. 2 →   0 Is D really such sort of trololo?)
•  » » 6 years ago, # ^ |   +5 Well technically if you don't come up with the idea it isn't clear that it's so simple. And also dynamic scoring makes it possible to give such a problem, since if it turns out to be too easy, the score will just go down :PThough it's cooler to give such problem to contests where you don't see a global ranking, since when you notice 800 people solved it, you'd think it's something simple, and you might even get it right without any idea why it works.
 » 6 years ago, # |   +1 If you can give me an anti-case for the solution below of problem D, I can give you hundreds of System Test Failure: if(n%2) cout<<"black\n"; else cout<<"white\n1 2\n"; Thanks for having such a funny problem! :)
•  » » 6 years ago, # ^ |   +7 It is a correct solution :)
•  » » » 6 years ago, # ^ |   0 I submitted the problem based on a hunch and without calculation, was really surprised after it passed. Then tried to make counter cases but failed to do so :p
•  » » » 6 years ago, # ^ |   0 I sent this solution, but can anyone explain why is it correct?
•  » » » » 6 years ago, # ^ | ← Rev. 2 →   +5 If n % 2 == 1 then black can use symmetrical strategy. If n % 2 == 0 then white can do step right, forgot about leftest column and do the same symmetrical strategy.
•  » » 6 years ago, # ^ |   0 No one can find "anti-case" of correct solution :D
 » 6 years ago, # |   0 Tell me, that solution for D is not:  if ( (n & 1) == 1 ) { System.out.println("black"); } else { System.out.println("white\n1 2"); } 
•  » » 6 years ago, # ^ |   0 It certainly is! =))
•  » » 6 years ago, # ^ |   0 Having (n <= 10^9) in this kind of problems might indicate a simple solution ;)
•  » » » 6 years ago, # ^ |   0 These cases are rare, IMHO.
 » 6 years ago, # |   +1 In last minute i could not submit my code for server (page Loading) problem :(
 » 6 years ago, # |   +4 For anyone asking, yes, the solution for D is that simple (4 lines of code).If n is odd then black can mirror moves, and as soon as white takes something from the middle column, black can take white.If n is even, then white can play "1 2" and ignore column 1 for the rest of the game. In this way you can view it as if they are starting a new game on nx(n-1) field and black is first. Now white can use the above strategy since the number of columns is odd.It's good that the problem had dynamic scoring, else it would've been a messy competition.
 » 6 years ago, # |   +5
•  » » 6 years ago, # ^ |   +4 and i failed on A and C XDD
•  » » 6 years ago, # ^ |   0 i saw more than 100 too...but finally his code got present pass...
 » 6 years ago, # |   0 A and B was easy. C was interest. hope my C will survive in system testing
 » 6 years ago, # |   0 How I can solve problem B?
•  » » 6 years ago, # ^ |   0 Literally follow the statement and do every check as it says.First check who got more points. If it is equal, check which sequence is lexicographically larger. If it coincides, check who had the last technique. Simple as that
•  » » » 6 years ago, # ^ |   0 thanks it's easy but ...
 » 6 years ago, # |   +2 Oh my... I misunderstood B "lexicographically" as appending all scores into string then compare them...
•  » » 6 years ago, # ^ |   0 Same here and at last 10 mins it was hacked
 » 6 years ago, # |   0 Can someone give a proof for D? :D
•  » » 6 years ago, # ^ |   +4 Here, check comments before asking :)
 » 6 years ago, # | ← Rev. 2 →   0 I'm not a professional hacker. Could you please tell me why this is getting invalid input for C? #include #include #include #include using namespace std; #define ll long long ll dp[6000]; int main() { cout<<200000<
•  » » 6 years ago, # ^ |   0 Possibly there should be a new line between the "1999999999" numbers and the "1" number. Your solution has 3 new lines in total.Though I have no idea if that is the cause.
•  » » 6 years ago, # ^ |   0 Because on second line you output 200001 numbers
•  » » 6 years ago, # ^ |   0 Change cout<<1<
•  » » » 6 years ago, # ^ |   +18 How can I try then?:D
•  » » 6 years ago, # ^ |   +12 Codeforces validators are very strict. You can't print a space after the last number and each line must end with EOL.
 » 6 years ago, # |   0 is it good practice to always use long long instead of int to avoid overflow problems like in problem b?
•  » » 6 years ago, # ^ | ← Rev. 2 →   +11 I had such period in my programming carrier where I would use only long long. On first glance it seems like a good thing but on more serious competitions such as IOI or ACM requiring some tough data structures or time limits on the edge, then long long can make the difference, as it takes twice more memory and is considerably slower than int when doing a lot of operations, so I stopped using it.However in Div2 A,B,C, I think using long long always shouldn't have any drawbacks.
•  » » 6 years ago, # ^ | ← Rev. 2 →   0 It depends. Sometimes it might slow down the program (operations on long long aren't as fast as on int) or exceed the memory limit (long long is a 64-bit data type while int is a 32-bit type).
•  » » 6 years ago, # ^ | ← Rev. 3 →   0 testing system has 32 bit processors, so use 64 bit integers only if necessary.
 » 6 years ago, # | ← Rev. 2 →   -16 d
 » 6 years ago, # |   +2 Oh, I didn't notice "If there are several such scores, find the one in which number a is maximum." in C :(I didn't notice to use something like long long instead of int for B :(
 » 6 years ago, # |   +13 Very good, balanced contest! Congratulations, albertg
 » 6 years ago, # |   0 don't care about high rating this time ... just adore to remember submitting any solution and get pretests passed and laugh xD xD
 » 6 years ago, # | ← Rev. 2 →   -6 test: #38 in the problem Binput: 3 -12 3 9output: secondwhy is second and not first?
•  » » 6 years ago, # ^ |   0 (12) > (3, 9)
•  » » 6 years ago, # ^ |   +2 Lexicographically, {12} > {3,9}
•  » » 6 years ago, # ^ |   -6 first (3 , 9) = 12second (12) = 12they have the same number of points so u should check which one is lexicographically greaterso it is second
 » 6 years ago, # |   +2 I just didn't passed problem A and i had error ... so i left the contest...Maybe contest was good but i don't know why i was like this... :(
•  » » 6 years ago, # ^ |   +21 Thanks for letting us know
 » 6 years ago, # |   +5 My 99th rated contest. bye bye div 2....!!!! Nice to have 100th round in div 1...!!!
 » 6 years ago, # |   0 Is it contest too??? Why, problem D very simple, than A,B,C?
•  » » 6 years ago, # ^ | ← Rev. 2 →   +1 Problem D doesn't need being harder than A,B,C. Take ACM/ICPC as an example, the problems aren't sorted by difficulty. That mean you should read all the problems first.
 » 6 years ago, # |   +6 I liked this contest. Although I didn't done it well, but I think the fact that all the problems have such simple answers and they didn't need using any special structures was interesting... ! :D Well done albertg and thank you for this contest : )
 » 6 years ago, # |   0 For problem A I got wrong on pretest 6. How can a football player get two red cards in the same match ??? Isn't it a mistake when input makes us realize that in a football match one player can get two red cards .... how funny -_-
•  » » 6 years ago, # ^ |   0 In this problem player will not be removed from the game after a red card :/ Kinda weird
•  » » » 6 years ago, # ^ |   0 It's described well on editorial page, in a comment.
 » 6 years ago, # | ← Rev. 2 →   +5 From the statement of problem E, I couldn't understand that ai are non negative integers. However, after a time, I noticed that they were, but still, they should've mentioned it...
 » 6 years ago, # |   0 I have one small doubt in problem A. I had used variables t (its value is either 'h' or 'a') and card (its value is either 'r' or 'y') to represent team and type of card respectively. If I keep there data type as int then the output shows runtime error. If there data type is used as char then the code works fine. From my understanding, variable of type char can also be represented by int. Please correct me if I am wrong.Thanks
•  » » 6 years ago, # ^ |   0 When you read an int the system will try to find an integer — not a character. For a char, the system just find the nearest char after \n or ' ' to read. When you call for an int input, since the int was never found (for example, the last line of input) your program returns runtime error.
•  » » » 6 years ago, # ^ |   0 natsukagami: Thanks for your quick reply. It would really help if you could elaborate your answer a bit as I could not understand much.
•  » » » » 6 years ago, # ^ |   0 Representing a char as integer is fine, inputting it however isn't.If you have characters in the input you can't read them using int variables. You could read them by char. Later on, there's no problem to store it in int variable, but the way input works won't let you read characters as int.That's what I believe natsukagami meant :)
•  » » » » » 6 years ago, # ^ |   0 Actually, I myself was wondering this: int a; scanf("%c",&a); `Will it work?
•  » » » » » » 6 years ago, # ^ |   0 No it does not. If you print the value of a, it prints some random value and not the one that you gave as as input.
•  » » » » » 6 years ago, # ^ |   0 Enchom : Yes I also believe the same. Just curious to know more from the C++ perspective.
 » 6 years ago, # |   +1 Shouldn't it be forbidden to talk about contest in blog's during contest? Some posted information can be accidentally useful for someone. Comments about hacks and predictions of problem price dynamics can serve thoughts how to use competition time more effective to achieve better performance. Nor it is a table of results, there are not shown analysis, predictions or breakthroughs from these results, and if participant want, he should do it by himself. If participant reads, that many hacks are made on problem X, this can save him time to search by himself which problems are hot on hacks. And if participant reads that there are many hacks on problem Y, this can save him time for not searching manually that statistic in many pages of results, even if there are no hacks in his room. http://codeforces.ru/blog/entry/14959#comment-199414 on 1h 55th minute of contest http://codeforces.ru/blog/entry/14959#comment-199415 on 1h 56th minute of contest http://codeforces.ru/blog/entry/14959#comment-199416 on 1h 56th minute of contest
•  » » 6 years ago, # ^ |   0 write about it to CodeforcesPolice
•  » » » 4 years ago, # ^ |   +28 Where should I write about you?
•  » » » 4 years ago, # ^ |   0 You create a contest after 2 years and still didn't care to ensure a cheating-free and unbiased round. You should be permanently banned.
 » 6 years ago, # |   0 I got a wrong answer at final test on problem B because I used longint instead of Qword...A big lesson for me in next contest.
 » 6 years ago, # |   0 For problem A I never knew that if a player got a red card, he/she can still get a red card, which fails my solution. Forgot to use long long for Problem B :( Knew how to do E but fail and some case. :'(
•  » » 6 years ago, # ^ |   0 Read the comments also, A is described here...
 » 6 years ago, # |   0 http://pastebin.com/UjZFdCXRWhy with this code I take wrong answer in testcase 6. Could anyone help me,because I cant find my error for some hour... Thanks !!!
•  » » 6 years ago, # ^ |   0 because there can be equality bsk[i].dist=bsk[i+1].dist. You must be careful!
•  » » » 6 years ago, # ^ |   0 http://pastebin.com/X20rzZseI add that,but again... Where I am wrong again?
•  » » » » 6 years ago, # ^ |   0 Silly mistakes :P