Hello, Codeforces!
I'm very glad to invite you to Codeforces Round 658 (Div. 1) and Codeforces Round 658 (Div. 2). This contest will take place on Jul/21/2020 17:35 (Moscow time). In both divisions, you will have 2 hours to solve 5 problems (and one subtask). The score distribution will be announced closer to the start of the round.
Huge thanks to:
- isaf27 for excellent coordination of this round
- Fanurie, antontrygubO_o, Ari, DeadlyCritic, gamegame, coderz189, hugopm, Kuroni, IaMaNanBord, Priyank, SecondThread, solvemproblr, talibmohd, WNG for testing the problems and providing useful feedback.
- MikeMirzayanov for providing Codeforces and Polygon platforms.
I've worked hard to ensure the pretests are short and the statements are strong. Remember to only read the problems that you can solve, and may you have the best of luck!
Because I know you all have so many questions, I have compiled an FAQueue
- Q: Is it rated?
- A: Yes
UPD Here is the score distribution:
Div. 2: 500 — 1250 — (1000 + 1000) — 2250 — 3000
Div. 1: (500 + 500) — 1500 — 2000 — 2500 — 3000
UPD Editorial
UPD I filled in the answer to the FAQ. Also, congrats to the winners!
Div. 2:
Div. 1:
As a tester, give Monogon contribution.
Congrats on joining in on the tester-contribution conspiracy
give you negative contribution(
Your comment is really useful
Give you positive contribution :D
SecondThread be like, "You're welcome, Monogon"
I guess then we won't be having a screencast from secondthread.
Monogon, You may now change the Answer to the question ( Is it rated? ) to YES in the blog...
gotta wait for rating changes first so I don't jinx it
The amount of caution you're taking really says a lot about your past.
As a tester, contest is bullshit.
Reference: https://mirror.codeforces.com/blog/entry/76777?#comment-613713
Would be real fun if you hadn't given the reference though
As a tester, I recommend reading FAQ
ueueSo many questions and so few answers...
(and one subtask)
Hope we don't encounter statements like Unrated and ruined, Upset and demotivated from mike.
Please use original FAQ
ueue. Don't change.So this dude's pc is filled with screenshots I guess
"A picture is worth a thousand words"
Is this picture even relevant as reply to my statement or you just used it to prove that we are too dumb to understand xD
Its like Div2 F for me, can you please explain this image
"Ending racism by going vegan"
False.
Check revisions. Or check image source (you can do it by opening in new tab). Just a random image. Don't think much.
They do 2 jobs at once -
1. People can easily see I'm not the original author.
2. People can easily find who is the original author. Helps me in giving due credits to the original author.
When you realize that Pretests are short and Statements are strong. ;-;
![ ]()
Gonna be an amazing contest.
No shit sherlock
Chandler’s every comment is considered sarcastic these days
Remember to only read the problems that you can solve New thing in the announcement
what did he mean by this ?I can't get it
Then you shouldn't have read it.
.
Hope to get some relief after the deadly Div2 round #657.
Meanwhile
As a participant, I can ensure that good coders will have increased rating at my rating's expense. ;)
did I read it right?
Thanks to this, my potato brains took so long to understand the reversed statement :P
Why not this? (it's more accurate tbh)
Don't be so hard on yourself. It would be difficult to write good test cases without someone to fail all the problems.
I ruined your unrated round, now it has non-zero chance to be rated, I'm so sorry about it. =(
Don't reveal that contest is unrated, only testers should know that (for now)
????????????????????????????????????
Where's the Monogon Platform?
As a tester, this contest is unrated (for me).
That is so obvious. "As a tester" is trending on Codeforces.
As an astrologist, I predict long queues again. XD
getting a hunch that this one is going to be one hell of a ride or maybe 567 is still haunting me who knows
I think the previous round got into your head just too much that you can't even remember the Round number correctly!!
#Round 657
Older guys, please tell me if Mike Mirzayanov cares about mentions in comments
Guys?! :////
"Remember to only read the problems that you can solve"
Isn't it true Monogon ?
You know it’s true because his face matches Monogon’s profile picture
Such a great FAQ!!!
Short pretests(x)
Short but strong pretest with multi tests
Finally, Monogon is back!
Hello, I got quetion, in the problem D the test case include el case asdfghjk and the answer is 7, but the answer but the answer shouldn't be 6?. The string of the answer would be ddddgfee
sorry, ignore me, I was wrong about competition blog
Codeforces is very good!There are three to four competitions a week!
what does a short pretest mean? Less tests or just easier pretests? edit: sorry if im misinterpreting something or if theres some nuance but it would be really helpful if someone could answer instead of just downvoting
"short pretests and strong statements" is a joke, it should have been "strong pretests and short statements"
ah ok no wonder i couldn't understand any of the memes. Thanks!
I've worked hard to ensure the statements are strong
Don't tell me it's 2 hours of thinking for 4 lines of code..
all they are attempting to do is demotivate contestants and cause fewer people to participate
[Deleted]
copied ?
I'm very sorry to say but this round is going to be unrated
This month is already a disaster(in terms of our heartbreak during contests). I hope this contest will conduct smoothly. All I want to not see that popup message from mike! Let's hope for the best
your wish is granted!
Wow, Monogon is this you?
Thanks. I can't believe you made me waste my time watching yoyo videos on Youtube
communicating in internet is tough
Bruh!
It was about me watching anything. not blaming you. I found yoyo weirdly satisfying and ended up watching for like 30-60 mins xD (some 3A, 4A finals and stuff). It was a joke and wasn't blaming you, was instead thanking you lol.
Ok, I got it now, sometimes it's hard to figure out the tone of the voice in a internet chatbox :v
As someone rightly said :-)
"communicating in internet is tough"
I found another one, by Eva. I'm not 100% sure if both they are same, although they look same and have same name.
rotavirus can u plz confirm this?
It's my kind twin
Never heard of twins having identical names.
that's the joke
Does it matter? I won't be surprised if I get to know that the real person behind rotavirus is a male. Who knows maybe he got crush on this singer Eva Krauze and made an account in her name.
Why have you created a new account to say this
Isn't this obvious? Ms/Mr rotavirus
It's not obvious for me. Once again, why do you need a new account?
still eva's personality is kindda cool.
Is that the old version of TikTok?
Great contest
What is mean by one subtask?
One problem have easy and hard version *
constructiveforces!!!
Hope to become a master after this round.
Reading the blog, this looks to me a very different contest than usual. Really excited for this one!
Monogon how many shared problems will be?
div2(C+x) = div1(A+x), so 3 shared problems.
The subtask is on div2C = div1A, so it is also shared.
-1
do you guys know when will they announce the answer of this (Q Is it rated?). If announced can you leave the link below? If it's not rated I would rather virtual this round because in my time zone it's late night. Thanks!
is there a link that announced it will be available after the round?
What does it mean by (1000+1000) in score distribution of div2?
Subtasks: C1 & C2 are worth 1000 each, so C is worth 2000 overall.
div2C has an easy version and a hard version. Each version is worth 1000 points, so 2000 total.
I'm new to cf, but why do they tell you do only read problems you can solve?
Because if you know you can't solve them, why waste the website's precious resources by requesting for the problem page?
It's codeforces new strategy to reduce server load.
oh I see
They meant "only solve the problems you can read".
After seeing score distribution
Good luck with question B.
I'm not strong enough to compete with all of you >_<
I need do more problems, luck for you!
Is that #657 that got you demotivated?
In div2, D is worth 12% more than C (that's 2250 vs 2000 points). In div1, those two problems differ by 50% (1000 vs 1500 points). Maybe these two fractions shouldn't be equal but should they differ that much? I don't think so.
#geometricprogressionmatters
well in div2 people usually solve problems in order a b c d etc . and it takes time to solve c1 and c2 and that time is gonna be counted for both of the problems . (penalty would be too much for c1+c2) i think its the reason .
You ignored the fact that penalty is in proportion with the problem points.
awaiting a good round
Hope,It will be a great round and we all get high rating, in shaa allah.
.
so your compiler of FAQ didn't show any output !
System test would be a disaster today. Why?
For no reason I hate subtasks. :/
Remember : Only read the problems that you can solve. If you can't solve it, don't read it in the first place.
Interestingly, all 4 of these are helpful advice:
Problem page for me keeps loading.. It's showing nothing
Problems are great, I wish the queues don't get really long this time.
I had a correct answer to C1 and I resubmitted by mistake because I had both C1 and C2 open and I was trying to submit to C2 the improved solution. This cost me 200 points :(((
( I submitted C1 after 30 minutes and the second one was after an hour)
Same with me. Isn't only the first accepted submission supposed to count? Or have the rules changed? :(
But pretests passed does not mean it will always pass system testing. The initial solution may not be totally correct so one might want to resubmit a better solution that also passes pretests, but would also pass system testing.
In addition, haven't the rules always meant that resubmission costs 50 points no matter what?
Well it would be nice if you could choose (the default is the last one, but you can choose a previous revision).
In D won't the answer of last test case be YES?
If we take A-[4 3 2 5 1 11] and B-[9 12 8 6 10 7] .
No, because 11 and 9 have to be in the same array. The big observation is that if there is a maximum up to now (which 11 is), then until you pass that max, all of the following elements must be in the same array as the max. That's because if they are smaller, and they were in the other array, they would have been picked before the max.
Think about your example. after 4 3 2 5 1 where chosen, there could be two scnarios:
a = 11 ...
b = 9 ...
or:
a = 11 9 ...
b = ....
The first case CAN'T happen, because 11 was picked, so 9 has to be in the same array with 11.
My solution simply groups together elements that have to be in the same array, and then I create an array of the number of elements that have to be grouped together. in the last test case, the list of elements is [{4,3,2}, {5,1}, {11,9}, {12,8,6,10,7}] which turns into [3,2,2,5] Now each of these groups can be assigned to any array, so you need to find a subset of elements who's sum is equal to n, which is the subset sum problem. Then I copied this dp solution: https://www.geeksforgeeks.org/subset-sum-problem-dp-25/
And all you have to do is use this function and return "Yes" if True or else "NO". My solution:
(given that I copied isSubsetSum from geeksforgeeks):
Hmmpfffh! Totally disappointed by the explanation of Problem C. It's been 20 minutes and still not able to understand it fully.
What part of it do you not understand? In one operation you take some prefix, flip the bits and reverse it. Then you want to turn string a into string b in 3n operations (or 2n, for the second subtask).
It wasn't clearly mentioned that we'd to reverse and then flip the bits (doing vice versa would yield different results!). Overall, it was a confusing statement but a nice question.
Can you give an example of a string such that reversing the bits and then flipping them produces a different string than flipping and then reversing them?
Is flipping the bits dependent on order in any way?
I have submitted code B twice. Then I realize the first code was not wrong. Is there any way to cancel the last submission? My rating has changed a lot because of the last submission.
No. There is no way to cancel any submission.
i think you can lock one of your submission for judging.
on submission tab there is lock icon.
Are you sure that it can help?
It won't change A LOT.
Nice problemset! Really enjoyed the contest! :)
In D won't the answer of last test case be YES?
If we take A-[4 3 2 5 1 11] and B-[9 12 8 6 10 7] .
It would give 4 3 2 5 1 9 11 12 8 6 10 7. Which is different from the last test case. Also, don't leave your comment under other's comment.
merge(a,b)= [4,3,2,5,1,9,11,12,8,6,10,7] not [...11,9...]
My Video solution for Problem B. Hope you Like It.
Am I the only one who solved Div1A2 using Treap?
Solution: smash me
😩😩😩😩
please make contests harder, this one wasn't fun
previous one was pretty hard :p
Speaking for div1, lots of contestants only manage to solve A or A+B, and the competition boils down to solving these 2 faster (=typingforces) — and the scoring distribution among the second half of participants doesn't reflect their skills. Harder contests will make this even more problematic.
oh i forgot to look at the standings and realize C wasn't easy
Out of curiosity, is C the type of problem you have been advocating for? It seemed to be a pretty good example of easy solution, nontrivial implementation (assuming my solution is correct).
implementation was trivial, sorry
:’( I should learn how to code
Either we're talking about different problems or we have a different notion of what trivial is
how did you manage to get WA on A1 and AC on A2?
I submitted different codes
oh yeah, I saw they were slightly different, so wondering what the key difference was
i don't know, check yourslef
Hmm.. now I think those two smiley faces in your profile actually symbolise two people on one profile.
Adam and Eva
How to solve C2? Was it based on a similar technique as C1 with optimization, or an entirely new way?
Instead of reversing string i access string form back and front(using deque). Everytime making a character equal i remove that from a and b. And i handle flip of bit using equal and not equal.
Use two pointers
Please, someone, help me with C2. Thanks in advance
make a either all 0 or all 1 than solve it from the last index
Yaa that I get but what about reversing string in each step??
there will be no need to reverse, think for a moment u will get the idea
That's because all of them will then be either 0s or 1s. Right?
exactly!!
this is much better what I was doing was adjusting the first index of a according to the b[i] and then reversing. before checking the value of a[i] I was just adjusting its value. I saw the patter to how I should adjust value just before 2 minutes at the end :(
I missed div2 C2 by 10 sec. I am pissed i am always careless.
how do you make everything 0 or 1?
let say we r at index i from i-i-1 a is either 0 or 1 so if i is same then we have to nothing otherwise change 0-i-1 values
i did it using two pointers and flag that shows the fact that s[l,r] has been reversed
Any hints for D?
Is the required and sufficient place where a snake can flip around a vertex $$$v$$$ connected to 3 disjoint paths with length >= snake length? I assumed so and looked for all such vertices $$$v$$$ which the snake can reach with its head/tail, but got WA, so I'm wondering if I have a bug or the idea is wrong.
now after problem C1, I won't forget that "STRING IS IMMUTABLE"
D1D was inspired by task from MIPT workshow (2019 day 5 B Little Worm). Both are extremely shit.
... which is taken from Polish ICPC stage (AMMPPZ in Cracow). I was one of the organizers of that contest and I was too lazy today to search for the solution code — solving other problems seemed more fun.
I've wasted a lot of time trying to use these codes — I think that it's hard to use them as the problem was slightly different.
I've used the code for the Little Worm problem to check if we can reach a diameter. It's a bit easier to solve it if our snake is already located on a diameter.
Well, code from that problem didn't help me much, although some parts of the solution share the same idea.
Also, I liked both problems and I don't think they are too similar: in older problem, the start and finish positions were disjoint as paths, in today's problem they coincide. I hope I will not see the problem without position restrictions in a contest, though :)
How to solve C1 with 3*n operations?
change elements of a from the end one by one
solve from the last index if it is correct than just remove it from a if it is not make it correct with the help of 1 index
I got pretests passed both subtasks with a simple greedy algorithm:
make string a all '0'. Then create string b from that.
You can always use the zeroth index character for swapping. Iterate from back of first string if its different , then check for conditions.In case — the first character of first string is different from character of second string , you can just perform operation once and update the string : else you need to perform the operation two times first on the very first character of first string which makes it different from character you wanna change for in second string and then perform operation on prefix of first string of desired length.
Ps: sorry for bad english!
need a quick editorial now
Div2A, Div1B, Div1C, Div1D — Codeforces? More like YesOrNoForces
(I'm actually mocking people that complain about the lack of diversity in problemset by checking similarities that are not relevant).
C2 is very interesting. Do we need any data structure to proceed operations?
keep a variable for zeroth index character and one variable for number of reverses.Iterate from back and keep updating both of the variables as required.
No, I solved it with array only. Link
in C-2 has anyone thought of doubly LinkedList kind of thing with a status variable?
Yess. I think will enable us to solve using in 2n operations and O(N) time.
I used deque
Do anyone know how to bitset in dynamic length?
Please help. I think I got TLE on pretest 3 in C2 coz of inefficient implementation of this :/
Same happened with me.
No. I think the main issue is that your solutions is $$$O(n^2)$$$
Yes My code was doing in 2*n operations but time is O(n^2).
So bitset probably won't help in this case
So How to resolve it or reduce the complexity?
Editorial has already been released
You can just keep two pointers. Its pretty fun to code it that way.
Okay Thanks @s161516 @udayan14
Anybody else wondering why problem B have more points than C1 ?
Is it rated? :)
Fortunately yes :)
this is like Div.3 compared to the last Div.2 :)
The sample test case explanation was enough for solving Div2-B.. but I didn't care to read it at first because I thought NIM was always based on XOR.. nvm got AC after reading it.
whats your approach and what you conclude from test case?
"The second player should take the stones from the second pile because the first pile is empty. He will take 1 stone because he can't take any other number of stones."
The first player can always force ze second player to take out any desired no of stones(which shall benefit him) in every turn , unless he is forced in the same way if there's only 1 stone to take out in the start.
As expected nice problemset. Next time i will like to solve problem named Monogon and rescheduling.
In D won't the answer of last test case be YES?
If we take A-[4 3 2 5 1 11] and B-[9 12 8 6 10 7] .
No, if you merge these 2, you will get
[4, 3, 2, 5, 1, 9, 11, 12, 8, 6, 10, 7] which clearly not equal.
Last div2 was like div1 and this div2 was like div3. :-)
-1+1=0. "Perfectly balanced as all things should be"
Some things can't be assume to be balanced like "blood pressure" if for half of the time it is above than normal and other half of time it is below normal then you can't call a patient as normal. I think same goes for difficulties in contest.
Video Solution to C1 and C2.
I have discussed how to solve in 2n operations and N^2 time, how to solve in 3n operations and O(N) time.
Finally optimized 2n operations and N^2 time to 2n operations and O(N) time.
Enjoy watching: https://youtu.be/TSr0x3EBWSg
I will most likely make for D also :)
Am I only the who who get WA in problem A on test 5(System tests). It's strange. UPD 87526239
In your code v[j] doesn't have to be exactly one, it should be v[j] >= 1.
Thanks, as Monogon said pretests were really short :(
Damn! You should be a tester.
It's good to see a geometry problem from time to time, even if it's nothing new and groundbreaking :D
It's good to see Errichto in comments from time to time, even if it's.. wait what.. no..
Instead I want to see you on contests page hosting one. :D
It's good to see you in comments from time to time even if it's just for the purpose of gathering some upvotes and increasing your overall contribution through random rheoteric comments.
It's good to see you solving geometry problems so easily, even when most of the people find them really hard.
I think the time limit of Div.2 D is too tight. I got the right solution when it was only 30 second before finish, but get TLE disappointedly. My TLE Code
I think you should stop using memset.
I think this is a good alternative(?)
From many past contest, counting this one I am having a syndrome that I call
"Coded Bug Free Solution after 10 mins of contest is over."
Any helpful tips to get the job done without bugs within time limit??
Every time you find a bug, answer 2 questions:
That's a good idea. I think I should maintain a journal about it.
Thank you for your advice!
I think instead of trying to code without bugs, learn how to debug.
What if I learn both to code without bug(Amortized analysis!) and also to debug.
How to solve Div2E?
I used DP on state (i, j, s) which means merge(a[1:i], b[1:j]) (the variable s is used to determine the (i+j)-th element of p belong to a or b)
Let x be the nearest index such that x > i+j and p[x] > p[i+j].
Then the transition is to try to append the x-th element to a or b.
I'm not sure about my solution (although pretests passed). Does anyone have another idea? ^_^
I think I may finally hit purple thanks to your contest :) So thank you!
I had to think hard the entire time. I especially enjoyed Div2 D. Not sure if it was the intended solution, but I ended up doing a subset sum problem on sizes of segments in the array, after realizing that the array could be split up into segments in a natural way.
Nice round imo. I think that for a long time there was no geometry and it's generally nice when problems touch various topics and ad-hocs aren't in majority. Kudos
(I already posted it but it was deep in a thread so probably people won't notice it)
An elegant solution that probably works for problem D (finished it 10 seconds after contest was over so not sure :| ): EDIT: Well, it TLEs on test case 30, probably just because of python :|).
[given that the function
isSubsetSum
is copied from https://www.geeksforgeeks.org/subset-sum-problem-dp-25/ ]PLEASE use the spoiler feature.
Done.
Interesting observation: when you get WA on pretest 1 on problem C (div1), if you click on your submission, checker tells you what's wrong with your output and provides some additional information (in this case, for example, that in the test case 2, x is not what it should be). You also don't get any penalty for WA1.
This is kinda non-obvious, and gives some slight advantage to people who decide to check the details of the submission. Maybe we shouldn't print stuff like that in a checker?
Printing helpful information in the checker has always been preferred. But I believe it's not available during the contest, and you only see the verdict itself.
No, I actually saw the exact same thing during the contest too, and used it to debug my solution in the last minutes. In was definitely easier than understanding what's wrong myself.
I agree that printing stuff in the checker is helpful, maybe CF shouldn't show checker output to the participants then.
Anyways, thanks for the round, I liked the problems! (even though I wrote a silly N^2logN solution with N Fenwick trees on B :)
Why not show the output? This is the sample, so participants could very easily run their program against the case and figure out what is wrong (except if maybe they misunderstood some part of the problem, in which case it is very much in the spirit of samples to give some help as to where the issue is).
Well, you never really know what checker will say (just "answer is not correct", or "answer is not correct because of X"). To find out you need to get WA1 and check out the submission page, which is not obvious, and may give advantage to people who happen to do so.
And output in the style of "answer is not correct because of X" can be very helpful when you are constructing the answer, and using sample 1 to see if your construction is correct.
It gives additional information on contest time too. Today i got it on D2C1.
And i have seen this few more times before. Sometimes it helps to verify if i understand problem in wrong way.
Very bad pretests in A2. Why didn't you add the max pretest? I thought that if the solution passes pretests in terms of perf, it would be accepted.
Mai_madarchod_hu is in 2nd position of today's round. I am just imagining the post with the winner's list XD
In his previous contest also he was in the 2nd position. lol
😂
I have a rating of 1282(Pupil). Just wanted to ask if Round 658Div2 will be rated for me and will it affect my graph, as it is not updated as of now. I'm new here, please let me know. Thanks
You can check your increase or decrease in rating here CF Predictor.
After going to this url just select the contest from dropdown and find your name in the list.
Thanks
I wish the contests would have been 2:15. Then I would have got D
:((((
Hello, Monogon
I think the main test data for div2D is weak.
Check this 87590140 for example.
Input:
The answer should be YES, but this submission provides NO. Please have a look into it.
I'm sorry that the tests seem to be weak. The final standings are already out, but I can add test cases like this to the system tests so that more wrong submissions can fail in practice mode.
Monogon Please add this test case as well. It seems to give NO as the output for some codes (including the one mentioned above) whereas the answer should be YES.
Input:
1
16
27 1 28 2 29 3 4 5 6 7 30 8 9 10 11 12 13 31 14 15 16 17 18 19 32 20 21 22 23 24 25 26
Thanks for the round!
My screencast: https://youtu.be/VaCa0CQpYbo
Monogon, Thanks for the contest! I liked it :)
This was my fifth contest and I liked it. I could have solved the unmerge problem. Ran out of time. Need to get quicker
The first time I solved a D and got Pretest passed, they failed system test and got TLE.....
Maybe the pretests were infact short :P
Maybe only me can't find the operations that transform the string a into b in more than 2n steps...I think 1A1(2C1) is a little strange.Because if we fix the bits one-by-one,it's so easy to find a 2n steps in O(n) time.But the contest is nice and thank for +77 lol
There were some random solutions people used, several 3*n solutions worst case, and a couple 2*n solutions that weren't optimized to n^2 in testing. Monogon posted some of them in the editorial if you're curious.
1C = 1D?
[deleted]
:(
Does anyone have any idea behind the reason for rolling back the ratings?
Did I miss something?
It usually happens when some cheaters are caught, causing the rankings to be re-judged.
I think the same must have happened this time too.
Could this be the reason?
Yeah, but Monogon clearly states that he will amend test cases for the practice mode, I don't think that it would affect the contest's ratings rollback
In D2C2, I tried implementing the solution 1 of editorial and it works fine on my system. However, it is giving Runtime Error on submitting. I've tried debugging but to no avail. Can someone help find the mistake(s)? My solution: https://mirror.codeforces.com/contest/1382/submission/87742162
Mai_madarchod_hu orz