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 kostka.
Fixed :D
you must be confused
Tow blog ? why?
Wow, what an intriguing round number; 281 is the sum of the first fourteen primes!
Yes... And its sum of digits is a prime really interesting
1! + 3! + 4! + 5! + ... + 281!
is also primeThat is interesting XD
281 is Sophie Germain Prime
281 twin prime with 283
281 is Chen Prime
281 is Eisenstein prime
Also
281=5^2+16^2
281^2=160^2+231^2
i sense wolfram alpha
no wiki
hahahaha really interesting :D
We shouldnt forget that 281 itself is a prime (nobody actually pointed that out)
and its number of ones in base 2 is a square such an interesting number
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!!
Wow, I also noticed that 281 is either an interesting number, or the first non-interesting number, by induction!!
You mean pigeonhole principle?
haahahhahhaaha wooou
Please explain why inudction work for this for bad math skill like me
That's why you are the king of numbers :p
You are exactly the King of Numbers. You know a lot of special things about numbers :D
P/s: HidenoriS was a bit faster :(
u cant find so much thing for 282
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.
Also
Also
281 = 281 + x * 0, x — any number
281 = 281 — 1 + 1
......
Hope short and simple problem description just like the announcement :)
Also hope to see a nice problem-set and rating growth..
This contest's registration will be end 30 minut before the contest Be careful!!!
Good time for Asian participants :)
PLZ unlike me :))))) PPPPLLLLLZZZZ
Hope more than 4000 contestants.All the fighters fight each other. Happy Coding.
Hello Every Body
I Love Codeforces <3
I want unlike plz unlike me (:
Dynamic scoring and 4000+ contestants?! Lets hope that the testing system wont crash. Good luck everyone and to a higher rating!
What does dynamic scoring mean?
http://codeforces.me/blog/entry/4172?locale=en
Thank you! :)
for me dynamic scoring means low rate :(
what does locking a problem do???
to be able to hack others solution in your own room
Hacks and Hacks in Problem B. I didn't see such amount of Hacks in a problem.
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 1
or
2 1 -1
Guess what -33 submissions on E and growing ... solving E isnt worth a penny anymore its score will be like 150 to me...
Sweet, sweet revenge :)
Good bye blue color see you again :(
This feeling...
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?
overflow?
Well, I'm impressed by the amount of overflows then :D
Overflow on a test like this:
Probably overflow in sum calculation?
I managed to hack two solutions with
because lexicographic comparison wasn't implemented correctly.
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 1
or
2 1 -1
Participants tried to concatenate two strings and compare them lexicographically. So for example I hacked with that test:
11 > 9 => true
, but111 gt 93 => false
How to solve E ?
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.
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
Is D really such sort of trololo?)
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 :P
Though 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.
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! :)
It is a correct solution :)
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
I sent this solution, but can anyone explain why is it correct?
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.
No one can find "anti-case" of correct solution :D
Tell me, that solution for D is not:
It certainly is! =))
Having (n <= 10^9) in this kind of problems might indicate a simple solution ;)
These cases are rare, IMHO.
In last minute i could not submit my code for server (page Loading) problem :(
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.
and i failed on A and C XDD
i saw more than 100 too...but finally his code got present pass...
A and B was easy. C was interest. hope my C will survive in system testing
How I can solve problem B?
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
thanks it's easy but ...
Oh my... I misunderstood B "lexicographically" as appending all scores into string then compare them...
Same here and at last 10 mins it was hacked
Can someone give a proof for D? :D
Here, check comments before asking :)
I'm not a professional hacker. Could you please tell me why this is getting invalid input for C?
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.
Because on second line you output 200001 numbers
Change
cout<<1<<endl;
tocout<<endl<<1<<endl;
and try then.How can I try then?:D
Codeforces validators are very strict. You can't print a space after the last number and each line must end with EOL.
is it good practice to always use long long instead of int to avoid overflow problems like in problem b?
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.
It depends. Sometimes it might slow down the program (operations on
long long
aren't as fast as onint
) or exceed the memory limit (long long
is a 64-bit data type whileint
is a 32-bit type).testing system has 32 bit processors, so use 64 bit integers only if necessary.
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 :(
Very good, balanced contest! Congratulations, albertg
don't care about high rating this time ... just adore to remember submitting any solution and get pretests passed and laugh xD xD
test: #38 in the problem B
input: 3 -12 3 9
output: second
why is second and not first?
(12) > (3, 9)
Lexicographically, {12} > {3,9}
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... :(
Thanks for letting us know
My 99th rated contest. bye bye div 2....!!!! Nice to have 100th round in div 1...!!!
Is it contest too??? Why, problem D very simple, than A,B,C?
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.
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 : )
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 -_-
In this problem player will not be removed from the game after a red card :/ Kinda weird
It's described well on editorial page, in a comment.
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...
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
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.
natsukagami: Thanks for your quick reply. It would really help if you could elaborate your answer a bit as I could not understand much.
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 :)
Actually, I myself was wondering this:
Will it work?
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.
Enchom : Yes I also believe the same. Just curious to know more from the C++ perspective.
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.me/blog/entry/14959#comment-199414 on 1h 55th minute of contest
http://codeforces.me/blog/entry/14959#comment-199415 on 1h 56th minute of contest
http://codeforces.me/blog/entry/14959#comment-199416 on 1h 56th minute of contest
write about it to CodeforcesPolice
Where should I write about you?
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.
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. :'(
Read the comments also, A is described here...
http://pastebin.com/UjZFdCXR
Why with this code I take wrong answer in testcase 6. Could anyone help me,because I cant find my error for some hour... Thanks !!!
because there can be equality bsk[i].dist=bsk[i+1].dist. You must be careful!
http://pastebin.com/X20rzZse
I add that,but again... Where I am wrong again?
Silly mistakes :P