Here and there, summer's in the air! (I beg your forgiveness, residents of the Southern Hemisphere... > <)
I'm delighted to invite you to Codeforces Round 487 (Div. 2), which starts at Jun/11/2018 16:35 (Moscow time). Please note that the timing is, as usual, unusual.
This is my third time creating a contest from scratch. Along the way can be seen the efforts of: KAN the super-ultra-hyper-mega-meta coordinator, who has reviewed, refined and translated the problems; 300iq, Livace, mike_live, Noam527, RobeZH, and Tommyr7 the super-ultra-great-delicious-wonderful testers, that have populated our collection of solutions; and MikeMirzayanov along with the super-ultra-extreme-awesomazing Codeforces/Polygon team, who have made all these happen in the way it is! Kudos to all of you!
The round will be rated for contestants from the second division, and the first division are welcomed as out-of-competition participants. There will be five problems to work on for two hours. The scoring distribution will be announced later, because of... love.
Despite my illiteracy, I included the stories in the hope that they'll be inspiring to some; feel free to skip them, if you'd like to fully concentrate on problems themselves.
We wish everyone a fun experience and a fair rating. We'll be pleased to have you on the contest!
Gone are the freshness and beauty of springtide, which raises the downheartedness in Mino the poet, as in many other poets. Mino's best friend, Kanno the painter, however, is intrigued by the changing palettes brought about by the seasons. On this day, their journey in search of spring begins...
UPD 1 The scoring is standard: 500–1000–1500–2000–2500. It's however strongly recommended to read other problems if you're stuck, since you may not necessarily find later problems harder. Good luck!
UPD 2 Congratulations to top contestants! Also big kudos to all participants!
Div. 2 Top 5
Overall Top 5
- olphe
- mjhun
- Inner_x_Peace (First to solve E!)
- kobae964 (_That_ close! Integer division, maybe?)
- jorik
UPD 3 The editorial is out, see you there!
Cool announcement.
i hope problems be cool like announcement :)
We need more announcements like this
This is the best round announcement ever
It says that first division will be out of competition. Even 1900-2099 ?
Technically, no, since this is a Div.2-only contest.
i.e. C.Master participants are also rated.
It will be rated for everybody up to 2100. Participants with the ratings 2100+ are invited to take part unofficially.
ok thanks.
Can you share the two round number you are talking about?
Both googling 'codeforces round cyand1317' and viewing their blog suffice; the other rounds are #418 and #431.
Or checking his profile under Problemsetting http://mirror.codeforces.com/contests/writer/cyand1317
Really enjoyed reading announcement. Specially —
Here and there, summer's in the air! (I beg your forgiveness, residents of the Southern Hemisphere... > <)
Please note that the timing is, as usual, unusual.
Gone are the freshness and beauty of springtide, which raises the downheartedness in Mino the poet, as in many other poets. Mino's best friend, Kanno the painter, however, is intrigued by the changing palettes brought about by the seasons. On this day, their journey in search of spring begins...
Programming Contest is my drug.
Codeforces is my dealer.
Thanks Codeforce for two consecutive contests in two consecutive days.
Your words seem more of that of a poet rather than of a coder.
Is it true or not that 300iq have 300iq?
It is not
so u have more or less iq?(turn on ur sense of importance)
I have 35 iq.
I hope it is truen't
Did you change your name on cs academy after the team selection for IOI in Russia? :D
Yes, you are right :)
:D I actually thought that this year you would pass.
the super-ultra-great-delicious-wonderful testers. Delicious ???
I can confirm.
It is your way of writing that is awesomazing :D LIKE THIS ANNOUNCEMENT <3
cyand1317's round again!
it's will be nice contest for every participants
Let's hope it will! (Looks worriedly at the list of red-orange registrants and then problem E...)
ProblemE is easy?
this comment makes sense now :D
Hmmm.So bot[Noam] is replacing Human as Problem Setter :P
Only Discord Server will get it xD
Friends are the worst.
Still everyone talks about the same. :( YES IT IS RATED FOR YOU
This isn't me actually, my friends got my account open and did this to get me downvotes.
My friends have been doing that too.
Okay sorry then.
Now you got
(32-11)
upvotes. Friends are the best. Hence proved.I guess you are right. I misjudged them. They just wanted some upvotes for me. I couldn't think it through.
Hope everyone could play the game well.Besides,how to increase my contribution?My contribution is below 0.
There are a few [not] easy ways:
Maybe you're new to codeforces. there's absolutely no rule. people get upvoted and downvoted for apparently no reason whatsoever.
killer_god you are god or killer or either
I am both.
cyand1317, you could change time and date as per this comment
Updated, thank you!
Looking forward to this contest, good luck and high ratings.
Best announcement on CF!!!
My rating have just become 2101 after the educational round in yesterday. This round suddenly becomes unrated to me :(
Wow, Chinese contest creater.
And such a cool announcement!
Hope that the problems will be as friendly as the announcement.
( And without terrible DATA STRUCTURES.. XDDD
Will Mio and Yuko be the characters of problem statements?
No, but they'll say interesting Hitokoto-word-kotoba's like Mio and Yuko do.
Is there a hacking round in this? If yes, what are the rules regarding the same?
I think it happens concurrently with this round as default, where you can start hacking others on a specific problem after passing pretests and locking it.
Yes. EDIT:
Only the normal room hacking.
Huge problem statements -_-
He did mention in the blog that you can skip the additional story..
1hour passed && only 1 Pretest Passed on problem D!.Really?Is it Div2 Contest?Or Typical Chinese round??
OMG, Prob.D&E is too hard...!
problem E will give nightfall to everybody
1324 hacked
What's the intended solution for E? I had idea for matrix exponentiation, but was getting WA on 3 :/
Maybe I got the mistake in my thinking :|
I was trying to find the answer for individual lines only, disregarding the fact that multiple lines can coincide :|
But then this probably makes the problem much harder than what I thought during contest
How to solve c?
Make a quarter for each letter, that will consume 1 component of each, and each group will have 25*25 letters. e.g:
Now put the rest of each letter inside the quarter of any other letter without touching each other, that way, each letter will have up to 12*12 components to create. e.g:
thanks for the help :).
I know that in problem statement, number of connected components cannot exceed 100. But if we remove that constraint and have input as 1225 1225 1 1, then your solution will not work right ? Is there a way to extend your solution for above input ?
Wooow !! Such an elegant construction
Let the answer always be a grid of size 50 * 50
Initially fill the left half with A's and the right half with B's
Now to fill the remaining components make "holes" in each of the halves and place them accordingly.
Suppose a = 3, b = 3, c = 2, d = 2
The matrix will be (note that the actual matrix will have size 50 * 50 )
AAAAA | BBBBB
ABABA | BABAB
AAAAA | BBBBB
ACACA | BDBDB
make 50 50 matrix , use 1 component of B to make all components of A , 1 of C to make rest of B and similarly for the rest. like if input is 4 4 4 4 ,then matrix would look like
you are bot
Should I be laughing? :V
how it is possible that in Problem-2 output for test case 2 2 .. is no?
If p=n, then p is always a period. In other words, if x is the length of the string s, then x is a period of string s.
p is a period of the string s if "for all i, 1 <= i <= |s|-p". Now if p == n, then there does not exist any i which satisfies above constrained. Don't you think this was ambiguous?
No, I don't think so. The problem doesn't tell "There is an 1<=i<=|s|-p so that s[i]==s[i+p]", it tells "for every 1<=i<=|s|-p s[i]!=s[i+p]".
Prove that 5 is not a period of the string "01101". Show such 1<=i<=0 so that i-th and (i+5)-th characters of "01101" aren't the same. You can't because there is no 1<=i<=0 so that i-th and (i+5)-th characters of "01101" aren't the same. So it is a period of the string "01101".
D is only about pen and paper :)
Representing the time with a vertical axis will help save quite a little ink and paper. Just two different approaches :)
hack for B: n=2,p=1,s=".."
Problem E? What problem E? I don't see problem E but hundreds lines of my code for C & D.
I thought C is pretty simple? Just fill the first 25 rows with A, the last 25 rows with B, and change the cells with even row and even column until there's enough connected component of each type.
yeah ... I tunneled visioned real hard and tried to code a solution with 50 rows of A, fill holes for B C D, then fix A by chaining B C D holes together.
Not a good contest.
Incorrectly estimated difficulties T^T
Sometimes I hope that X-CPC regionals have some of their problems replaced by hard Div2 rounds.
Don't worry, the problems are pretty fun :) I was also surprised to turn on and see no passed pretests for D and E 1 hour into the contest. I still think all problems are suitable for Div.2 users (though I might be wrong on E, will submit after systest).
less than 1000 people worked out more than 2 problems
The real problem is less than 100 people solved D&E.
C fucked me up, was there an easy way I missed? Can anyone explain the solution?
Not sure about simplest but this is how I did it. Use the whole 50x50 array. Fill in top half with A, bottom half with B. It sort of looks like a grid jail. Put C's and D's in alternating spots. Put remaining A's in bottom half and B's in top half.
You can paint the four squares of 25x25 like this:
AB
CD
and then in the square with the A you paint the D's you need in the tiles with both x and y even, do this for the other three squares and you are done. It works because 25x24/4>100
Very cool. Interesting problem, but really hit or miss I think.
Does anybody know the possible hack for problem B?
May be it will help u. I hacked some people by this test: 5 3
1..1.
What's the correct answer?Please tell me.
There are four variants: 10011 10111 11010 11110
In problem B, can p<=n condition be established? if p==n, 1<=p<=0 .
D is very near to this one: D. Contact ATC
You can also observe that both problems were set by the same person... :)
LOL. So D was literally the 'upgraded version' of the older one.
In my opinion, today's one was easier.
Actually they are similar in statement only: solving one problem can't help you solve the other one.
When I saw problem 989D - A Shade of Moonlight initially, I misread it and couldn't solve, but solved another problem instead. That is how 956D - Contact ATC was created.
LOL. Which one you think is harder?
The one with airplanes.
In question B, I got wrong answer in pretest 2 and I got penalty of 50 points. Wasn't it the rule that if your solution fails in pretests given in problem statement as samples then you won't get any penalty.Someone please clarify
only if it fails on pretest 1
only if it fails on 1st pretest,then you won't get any penalty.
This rule is applied for the first pretest only to prevent the loss of points due to submitting a solution for a problem other than the intended one by accident, if any submission passes the first pretest but failed in any other sample/pretest you'll lose 50 points.
I got WA because print one whitespace after the answer. (http://mirror.codeforces.com/contest/989/submission/39151664 WA) (http://mirror.codeforces.com/contest/989/submission/39155233 still WA) (http://mirror.codeforces.com/contest/989/submission/39155400 pretest passed)
Umm.. Although this is my fault, I have never been wrong answered at least by writing '\n' or by inserting whitespace after the answer during every CF round I have participated in. I wasted few minutes(about 10min) and get one penalty because of this.
Is it possible to remove my first wrong attempt? Or is this just my mistake?
I'm working on removal of such submissions.
Thanks XD
Additionally, I get 15min penalty on problem B, which correspondence with score 60. (Submitting #39151664 12min, pretest passed #39155400 27min.) is it possible to progress the system testing by #39151664 instead of #39155400?
ㅠ_ㅠ
For problem B what's the answer if n == p?
print('No')
Maybe I'm misunderstanding something in the statement. Can you help explain why p is period if p == n?
if p == n, the whole string is the period and each position in the period appears only once, so whatever occurs there becomes the position of the period throughout the string.
You can think of it in terms of vacuous truth. if p == n there is no i such that i+p <= n, so all i's such that i+p<=n satisfy the property of s[i] == s[i+p] even though no such i's exist. Their count is 0, and 0 i's satisfy the previous property, so all these i's satisfy this property.
Thanks all, I got it now.
This is the most lame thing that can be added in a problem testing.Don't get offended but what was the setter trying to test by this thing?
always No
"No"
Because the string must match the definition for all 1 ≤ i ≤ |s| - p s[i] == s[i+p]
As 1 ≤ i ≤ 0 must be false, there does not exist an instance s[i] == s[i+p]
Note: for all x P(x) is true means that there does not exist a P(x) that is false
The answer would be no.
OMG second contest in a row i need 1 more second to press on submit button :D
So, as it seems to me, this round was really strange...
In Problem B, if p == n, we get a strange inequality of 1 <= p <= 0. So I think this problem has error regardless of answer.
I'm not sure how you derived this, but thinking about it from the perspective of the problem, this condition shows that the period = n, so the answer is always NO, since we can choose the periodic function to be whatever string is given. Clearly there is no logically inconsistency, so your formulation must be incorrect.
If p==n, Assuming this condition is true, then n values can not exist.
I don't understand your logic, what do you mean they can't exist? There is no issue. Like if p=n=5, maybe we have 10101. Then we see a repeating pattern of 10101 every 5 (which is the whole string), so the answer is NO. What part of that logic are you disagreeing with? What doesn't exist??
Yes it kind of amazes me that the setter penalizes for such a case which is ambigous.I was on the verge of solving C and then my solution got hacked due to this thing n==p and it never came to my mind that this could be the error.Really disgusting from a contestant point of view.
I have seen something "interesting".
When you know your rating will decrease, you asked your friends to copy — paste solution to get skipped. Then your rating will not decrease xD
Ugly Bug in the system then
That's why cheaters should get banned (at least for a few contests)
i was using substr function in my solution for the given question and was getting a runtime error in the case , but when i did the basic implementation it worked, not getting the runtime error as even a string of 100 letters worked fine on my compiler here is my solution link can someone help
Try test "A". Since size() and length() are unsigned, 1 — 2 causes overflow, and your for loop runs from 0 to "infinity"
Got it, thanks for helping
in problem B the given statement is,
a positive integer p is considered a period of string s if for all 1 ≤ i ≤ |s| — p, the i and (i + p)-th characters if s are the same.
so, if p == n there is no valid i which satisfies the given condition, hence there is no valid period, so shouldn't the answer be "YES" is this case. Costed me four WA.Can anyone provide any explantion!!! thanks
In this case, give me i such that i and (i + p)-th characters in s are not same. You can't do it, so "for all 1 ≤ i ≤ |s| — p, the i and (i + p)-th characters if s are the same."
this is like going other way round!!!
if there is no i for which any valid period can be formed (i.e all the i && i + p characters are same) how can we say that the whole string is a period.
String x and y are same if for every 1 <= i <= len(x), x[i] == y[i] Are x = '' and y = '' same ?
Proposition: every red crocodile can fly. It's true, because there are not any red crocodile.
In this case: for every i in {1... |s| - p} i ans (i + p)-th characters in s are the same. That's true too, because there are not any counterexample. So, string is period because it fits the definition.
but I still can't understand. if p==|s|, can I find n(=|s|) satisfying 1<=p<=|s|-p(=0)? Which n satisfy this condition(n==p && 1<=p<=0)?
There are not any n, which satisfy your condition. So, your condition describes an empty set. And for every element in empty set, any statement is true. For example, that i and (i + p)-th characters are the same.
'C' really made me crazy lol kkkkkkk was tough to me
I've written down several equations about Problem D, but thrown it away eventually. And I realized that wind speed is always positive after the contest. :P
It's not always positive though... the restriction is that absolute value is less than Wmax
Whhhhat? So constraint was just like http://mirror.codeforces.com/contest/956/problem/D, which was the original one I thought and I was still not able to manage it ;'(
Interesting problems, especially C. Can someone explain its solution?
AAAAAAAAAAAAAA...AAA
XAXAXAXAXAXAXA...AXA
AAAAAAAAAAAAAA...AAA
XAXAXAXAXAXAXA...AXA
AAAAAAAAAAAAAA...AAA
XAXAXAXAXAXAXA...ABA
BBBBBBBBBBBBBB...BBB
XBXBXBXBXBXBXB...BXB
BBBBBBBBBBBBBB...BBB
XBXBXBXBXBXBXB...BXB
BBBBBBBBBBBBBB...BBB
XBXBXBXBXBXBXB...BXB
BBBBBBBBBBBBBB...BBB
XBXBXBXBXBXBXB...BXB
replace X to A/B/C/D
I made a 50x50 grid, so that upper left 25x25 is filled with A's, upper right with B's and so on. After that you can put the remaining components to the grid by replacing some 1x1 areas with them.
That may not be the problems called 'Stupid problems'.Thanks for your work @cyand1317!
C is similar to this problem
Wow, my problem finally collided with an AtCoder one... Thanks for pointing out.
That's right.It's terrible.
Woaah... So many WAs on Problem B. :|
A silly test case does this for you.
Why answer is "No" when p == n in B?
Because you don't know what sequence is after N.
There is no sequence after N. So how can you say that "you don't know the sequence after N".
By reading examples on B. so I can say actually that is based on intuition instead of reading the constraints on B very carefully. (without considering whether constraint is really wrong like commented below)
It should NOT be no. I sent a clarification about this mid round and here is the answer: Can you please clarify? Is the person that answered me wrong, or is it the testing? [EDIT] Or am I? cyand1317
It is true that it's periodic, but problem asks if it's not periodic.
Thats right, thank you!
Regardless of whether the answer is always No, I do not think that the problem is not valid because there is no |s| that has length satisfying p==(n=|s|) and 1<=p<=|s|-p.
MRW I mistyped one variable in both A and B and the pretests didn't catch it.
Omg me too. I mistyped the array size in the last educational round (missed one extra zero), got ArrayIndexOutOfBoundsException :(
At this rate my contribution will be higher than my rating :(
And Problem B, Why
http://mirror.codeforces.com/contest/989/submission/39152340
is Accepted?
9 3 101010001
4th and 7th is same so answer is No. but this source print 101010001. I try to hack this source, but console does not appear.
Because s[i] = s[i+p] does not hold for all 1 <= i <= length(s) — p. For example, the 1st and 4th characters are different, so the above answer is acceptable.
Oh I misunderstand thanks :)
1th and 4th aren't the same so p can't be period.
I have met C before this round in atcoder.So it's unfair to those who did not meet it before.
:(
This test data for #B was not added in the system test. It's seems that many AC codes can't pass this data.
But I think the answer is 'NO'
cause you can't change '0' to '1', you can only change '.' to '0'/'1'??
Am I right?
Sorry, I was too careless when I post the comment..
We can't replace any digit that has already been given.
You cannot change the tide information if it has been given.
and yet another hackforces round ends
Where can I found problems like C? I need to practice problems like it, I am really slow with those problems
You're probably looking for problems about constructive algorithms then. Codeforces has many problems about them here. Not all of them are very similar to C, but some of them are.
Auto comment: topic has been updated by cyand1317 (previous revision, new revision, compare).
Can someone please help me with my submission for problem B (test case 31) ? http://mirror.codeforces.com/contest/989/submission/39155370
EDIT:- when comparing character, I wrote if(c==1) instead of if(c=='1') and it costed WA.Damn :(. How the hell did it pass the pretests?
Please note that the input has been truncated on the page. You may want to check your solution on smaller tests. You can also refer to the editorial.
I resubmitted the code only by changing if(c==1) to if(c=='1') and it passed the tests.Somehow if(c==1) passed pretests.Its just my bad luck.
Ok, I am really confused here, this submission:http://mirror.codeforces.com/contest/989/submission/39169572 gets runtime error on test 3 while this one:http://mirror.codeforces.com/contest/989/submission/39170689 gets AC. All I do is switch the condition i<s.size()-2 to i+2<s.size(), why are they not equivalent? I spent nearly an hour of the contest trying to figure out my mistake, can anybody tell me why this happens so I don´t do it again?
.size() return unsigned number, so -2 will cause underflow. And thus it is nice to use macro such as this:
#define sz(x) ((int)(x).size())
Ahh, now I understand. Thank you!
Most compilers will give you a warning though. Something about "signed/unsigned" comparision. Always try to make it a point to look at the warnings and see what they say. There's a reason why they are there ;)
Nice call! I compiled it with Xcode and it gave me a warning, I'll be more careful in the future.
Finally blue :'( Thanks @cyand1317 for this wonderful contest.
It's not blue btw, it's cyan :)
lol yeah cyan. Thanks
Now we aim for real blue.. :D
hell yeah. can't wait for next round :D
Rise of the knights.
again*
Hhhhhhh, my bad.
can we have reacts on cf as on fb?
It's however strongly recommended to read other problems if you're stuck, since you may not necessarily find later problems harder. Irony at its best.
I certainly didn't like the contest, statements were way too poetic, and more prescicely problem B's. Besides I performed extremely bad (not because the poems, of course). On the other hand I liked problem C (didn't solve it either).
Though a valid definition, it would've been clearer if we had explicitly stated that p = n is a period. We'll try to make the statements even better in the future. Meanwhile, there is always the option to request a clarification during contest :)
Best wishes.
No DP or graph problems at all? :(
problem E is
Problem B is wrong for p == n. Should have been unrated.
If (p==n) you should print "No",but not mentioned in the problem.
Can anyone explain problem E to me ??
duliu
Here and there, summer's in the air! (I beg your forgiveness, residents of the Southern Hemisphere... > <)
Summers always in the air!! Brazil <3
The host of this FIFA World Cup must be jealous of your winter.