Ciao, Codeforces! We're glad to invite you to take part in Codeforces Round 701 (Div. 2), which will be held on Feb/12/2021 17:50 (Moscow time). This round will be rated for participants with rating lower than 2100.
You will be given 6 problems and 2 hours to solve them.
We would like to thank
- MrBrionix, MyK_00L, taulant and TheScrasse (a.k.a. the jungkook official fanclub) for inventing and preparing the problems.
- isaf27 for the great coordination and the valuable help he provided at any time.
- antontrygubO_o for not being involved and hence not rejecting any problem.
- MikeMirzayanov for creating Codeforces and Polygon.
Last but not least, we also want to thank the testers: armyalpaca, dario2994, davi_bart, DeadlyCritic, franfill, HIS_GRACE, kclee2172, lorenzoferrari, manik.jain, mattysal, namanbansal013, Osama_Alkhodairy, Prakash11, rocks03, Shusaku, simpatine, stefdasca and Retired_cherry.
The score distribution will be announced soon.
We hope you'll like the problemset!
UPD1: The score distribution is $$$500 - 1000 - 1500 - 1750 - 2500 - 3000$$$.
UPD2: For technical reasons, the round was postponed by 15 minutes. Sorry for that, good luck on round!
UPD3: Editorial is out.
UPD4: Congratulations to the winners!
Div. 1 + Div. 2:
Div. 2:
First to solve each problem:
As a tester, i recommend you participate in this round! Problems are very interesting and statements are well written.
As an Italian dish fan,I predict this round is going to be equally interesting just like thier dish
Round author is from italy i.e. italian round
Wait does that mean we'll have to write some pasta-like code?
I wait for the day, when some tester doesn't recommend this! xd!
Postponed!!
hope it does not extend much
Contest Delay 15 minutes
Not meaning to be rude or aything but why did it get delayed?
server maintenance
it says something abt maintenance till 22:00.. will it be delayed further??
Nope it is utc 22:00 so contest wont affect i guess you are confused bcoz of time zone
yawn, it doesn't bother anyone in their neck of the woods. right now its dinner time in Russia, everybody's well fed and rested and setting in for the night. In other parts of the world, it's awkward timing, practically nobody is comfortable.
India falls within the comfortable time zone as well.
true
not that much as it's time is 8:05 to 10:05 pm. Many have their dinner time during this time period.
"The Beginning is the End and the End is the Beginning"
Well, the problems are difficult, but I like this round(because I became Expert)!
forgive my poor English:)
I like it too!Because I became Master!
I like it too, I became newbie again:)
I see what you did there.
lmao, poor anton!!
As a tester, I did not test.
As a person who wasn't involved in the preparation of this round, I recommend you to participate.
Thanks for your recommendation
As a tester ,I reccomend you to read all the problems. The statements are short so you won't lose much time.
As a participant looking for negative contribution, help me to reach global minima!!!
No, I don't think I will.
Isn't that true with human psychology?
Yes! You deserve my down vote for this :D
P.S: He asked for down vote
I request people to help him by up-voting him( given he was helping me to reach the bottom :P )
if i upvote, am i helping(with contribution) or obstructing you to reach global minima?
Obviously obstructing
We don't do that here
I don't agree on this, everyone helped me.
Many thanks to Kaey, MrBrionix, MyK_00L, taulant and TheScrasse for preparing the Div.2 contest.
Don't forget antontrygubO_o for not rejecting any problems
Can't you say anything other than thanks fr?
What's wrong with practicing gratefulness?
As an upcoming participant. I saw newbie tester :thinking:
I think judging someone based on his/her ratings is a crime, it's the passion for CC that brings everyone here, even in Chess not everyone is a GM yet the people who play it enjoy it, it's high time we start judging people based on the number of contests they have appeared in, as in that case it will ultimately benefit the entire programming community.
Like the early score distribution, the gap between C and D isn't significant, makes me feel comfy! Hoping for a great round! :D
Stefan stefdasca Dascalescu is back to Codeforces/testing/setting yeah! I think its cause the exams are finished finally in some univerisities but not all :(
We are hopeful to have such pretests set so that many of us will not be frustrated in the final standings(In the last round it happened).Thank you.
As a participant, wish you all great rating changes :)
Either positive or negative.
"Great negative rating change" doesn't make sense, I guess.
Merriam-Webster
Great
notably large in size : HUGE
all creatures great and small
No, I mean a "Great negative rating change" isn't a real "Great rating change" !
It's
Sad But True .
Words can have multiple meanings. In your link, see
4 — used as a generalized term of approval
had a great time
It was just great.
I didn't check your profile the last time I saw your username, are you really from Finland? If yes, why the mango-lassi? Not against it but expecting a good story.
It's not that great of a story. I first registered with the username "mangolassi", but lost the password (and used an old email I no longer had access to), so I made this account.
Right. But for a phrase to make sense just one meaning needs to apply.
Thanks to MrBrionix, MyK_00L, taulant and TheScrasse for setting the problems Hopefully , we'll enjoy the contest
You forgot Kaey :D
And also thanks to Kaey
difference between c and d is 250 only. what does this represent? is it that d is not much difficult than c?
Yes, D should be slightly easier than usual.
Well, this didn't age very well.
"easier than usual"
Again early score contribution, great! thank you!
As a problemsetter, MyK_00L says that problem F is easier than C.
As a problemsetter, only one tester solved F during virtual participation (it may be easier than C, though :D)
Let me guess, was it dario2994 ? XD
Maybe :D (we've already spoiled too much about the contest)
As a problemsetter, MyK_00L says that taulant shouldn't have dropped from yellow.
Has anyone noticed that all of the authors have the same profile picture?
Yes.
I guess it's because that picture is the logo of the contest.(At least you can assume that)
Well, not really at the beginning; I'm going to share the backstory here. At first, around 2 weeks ago, I took a picture from the Black Cherry sticker pack and set it as my profile picture on Codeforces and Telegram. A few days later, TheScrasse was looking for a profile picture to replace the Lichess horsey, and he didn't want to use a picture of himself, so I told him he could take mine. After a moment, I came up with the idea that we could all use that picture during the week of the contest.
Wow! It falls on Chinese Spring Festival. May my rating increase on the first day of the new year :)
happy lunar new year ^^, hope this contest will be a good contest ^^
i hope fair pretests !!
As a tester, I wish all the participants good luck and I recommend you all to read all the problems.
As a to be participant, I wish everyone good luck and happy ratings :)
I will be posting solutions of problems of this contest tomorrow. On this YouTube Channel:- https://www.youtube.com/channel/UCfX-OxxzYPELHxpNojOojcw
Are you sure you'll handle this?
doesn't matter even he is not able to do even B but at least he contributed something and at least tried rather than discouraging others
Best of luck buddy, we'll look forward to it
Thanks bro
Happy Chinese New Year!
Not related
Just noticed that. It makes delta 0 in unrated rounds. I think it would be better if it calculates virtual rate change like this
I hope this contest has strong test cases, especially pretests :)
Is it rated
Yes.
Is this comment just intended to get down vote? ( rated for participants with rating lower than 2100. )
The last Round was a nightmare for me (even today, I didn't understand the reason), Hoping that this time things will be much different, finger crossed.
best of luck....
abe saale tu bhi meri tarah khaliyar hai.
Happy Lunar New Yearrrr
Hopefully I will solve C today and become pupil
To become pupil AB solving(I guess up to hour) is sufficient
Well if B is of difficulty <= 1300 then I will do it easily I guess.But if its difficulty is >=1400 then I think it will be a challenge for me currently,Let's see what happens.Fingers crossed!!!!
As a tester, I wish all the participants good luck and I recommend you all to read all the problems.
Good luck everyone, i wish we all will raise our ranks
I hope there will be a palindrome related problem to honor the day (12.02.2021) :)
It's 12/02/2021 A question on palindrome would be fun to solve .
Happy Lunar New Year!!! :)
Long time no see :)
Happy Lunar New Year!
will the contest still be held? because Polygon and Codeforces will be possibly unavailable in the period between Feb. 12, 20:00 (UTC) and Feb. 12, 22:00 (UTC) because of maintenance.
That would be a few hours after the contest, so it is not a problem. (the contest ends at 16:35 UTC)
THe maintenance won't influence this contest because the contest will end at $$$\textsf{Feb. 12, 16:35(UTC)}$$$ :)
Is today CF round has some technical issue as the message is displayed ???..
No, the technical issue is not related to the contest.
Authors are different but their pictures are the same:D
As a human bean, I recommend you all breathe.
Is that you?
I wonder if those who downvote know who Mr. Bean is.
they probably know Rowan Atkinson and Blackadder too.
Do beans have lungs?
Only the human flavour
Human beans do.
antontrygubO_o for not being involved and hence not rejecting any problem.
Is it a joke?
What do you think?
Why contest nowadays are not based on proper ds and algo they are mostly ad-hoc??
https://codeforces.me/blog/entry/80049
I think creating DS and Algo problems that are completely new and of difficulty level Div2 B,C or so is hard. There are many of them already existing in different OJs.
Delay :(
shifted by 15 min.
This contest also starts postponing. Hoping it will not become unrated as well.
CONJECTURE : If you have exam next day and you attempt a rated round. You will screw up both ratings and grades.
Or you will just screw the exam as usual.
contest postponed by 15 min
here we go again.. delay...
ok lemme listen again.
Delayed by 15!!
Contest delayed...just hoping to not face a long queue!
delay of 15 min
Has the contest been moved back?
Now i know why they delayed the contest , They are watching LOCO CODM Cup Pro , mYm vs Godl .
Sorry for +15 minutes. I postponed the contest to be sure that everything is OK. I'm here, no reasons to worry. Good luck on the round!
Bhai Bhai
15min Delay is better than Unrated contest :)
I think so.
I was hoping this round won't be unrated again, but when MikeMirzayanov tells you he is here, just relax
Ek hi to dil hai. Kitni baar jeetoge
Codeforces Waiting for 20,000 Participants to Cross! Agree?
It is not good at all. Last time everybody shouted for the 30000 and people started coming out of nowhere. And lead to an unrated round. After that, all were disappeared, and numbers came around 20000. And now again IF you start this, IN MY OPINION people new account for such streak. which is not good.
DownVote if don't agree.
hope it remains rated...
They should not delay the contest it is quite frustrating
QWQ 15 min ..
Delayed for 15 minutes...
you got je'baited
My first contest in the new lunar year <3
yes idol !!
Ukm em = (
Even codeforces is taking time to start the contest and you think that your crush will start loving you so easily and early! ;-)
Don't be unrated please
waiting for 15 min when we are all set to go, is quite frustrating but we can wait for a better experience!
Noo!!! delay :( Wishing everything goes well :/
All the best 1 min remains now
My sister brought a fried chicken for me at 8:30. I said I'll eat this after 10:35.
Thanks for the delay
4 parallel universes ahead of us all
delayforces :) But Actually delay is better than Unrated round :)
Please don't make contests if u can't make one.
Bruh, don't blame the writers if you cannot solve the problems.
I don't see any problem with the contest. It's just that it is a little tougher than usual. And it's completely okay to have such small variations.
Welcome to the comment section, who left the contest unattempted after watching 1st question.
is your surname Modi? kyuki aapne meri "Mann ki baat" kehdi
thanks for clear and short statements , really liked the problems
Contest is running now, but I cant register now, why??
Wow even A was pretty tough!
Is it rated?
Yes.
:|
this was a hard div 2 contst
It's not a shit contest, but it is made for div1 after b.
You don't know shit about CF then. D2C is D1A, so it's always made for D1 after B.
This is why C solved by ~2k?)
Though I couldn't do my best today, I think the problem-set was pretty standard. Being unable to solve a problem doesn't mean it has to be a shitty contest.
Besides, you don't have any right to insult a setter panel like this. I enjoyed the problem-set. And I am pretty sure they worked really hard to make this contest enjoyable and successful.
20,000+ Registration and somewhat 10,000 people made submissions :/
How to solve C,D ??
Verry toough contest for mee :(
Hint : We can find all pairs $$$(a,b)$$$ by fixing remainder $$$R$$$. $$$R$$$ must be less than $$$sqrt(x)$$$ and we can do binary search .
Problem C :
Suppose we fix $$$b$$$ , then all possible $$$a$$$ will be of form $$$b*h + h$$$ where $$$h<b$$$ . Also notice that for given remainder $$$R$$$ , $$$b$$$ must be at least $$$R+1$$$ . Thus we can find for given remainder $$$R$$$ , how many pairs $$$(a,b)$$$ exist . If we fix $$$b$$$ , then $$$b*R + R <= a$$$ should hold .
Also notice that $$$b>R$$$ and thus $$$b*R + R > R^2$$$ . Thus all possible remainders for which answer will exist will lie in $$$[1,sqrt(x)]$$$ . For each remainder $$$R$$$ , we can binary search upper limit $$$U$$$ such that $$$U*R + R <= x$$$ . Then we can add $$$U-R$$$ to the answer.
Problem D:
LCM of all numbers from 1 to 16 is 720270. You can fill a matrix B with this number. Now all we have to do is to make differences of k^4. For that you can simply subtract A[i][j]^4 from B[i][j] in a chess pattern. Now all numbers in B are divisible with the numbers in A and they respect the conditions.
Here is my code: 107219536
For C, for one possible b, min(b-1,floor(x/(b+1))) values of a is possible I did it by breaking it in two parts doing first for b which are less than sqrt(x) and then the for the b whose multiples are less than sqrt(x). The numbers left need to be tackled separately so that any b is not counted more than once. Solution
lol that F was nice XD
How to solve C ? Plz
I used https://mathoverflow.net/questions/48357/summation-of-a-series-of-floor-functions
i use a = c * (b + 1) then c = 1...5e5 (c < b) for each c find how many b and a satisfy
a should be of the form n*k+k. Now n*k+k<=x, then n<=(x-k)/k. Now iterate over k from 1 to x (say). answer will be incremented by min(n,y)-k, I did this because numbers which have k as the remainder and quotient will be in between k+1 and min(n,y). Now if min(n,y) < k+1, then you should break the loop because right value is smaller than left value. You can check using simple maths that you don't need to iterate for k more than sqrt(x+1) times check to get the final answer
I like this type of contest :) Thanks for good problems.
How to do C or D ?
Very bad contest!
Unbalanced contest.
Today we had a Mathforces ! Problem C was too math oriented.
C should have been divided in two parts, with lessor and higher constraints.
I got the idea of C but couldn't implement in 1.5 hours :(
for each i from [1...a] , we need to find the number of second half of divisors of each i which are less than and equal to b.
I noticed a pattern in C:
a : b : cnt
3 : 2 : 1 <3>
4 : 3 : 2 <4,8>
5 : 4 : 3 <5,10,15>
6 : 5 : 4 <6,12,18,24>
so suppose take set for a=6 then every number in that set and b is special pair.
.....
a goes till x and b till y. Take approproiate minimas of x and y though.
I'm not sure if your approach would fit in the constraints as x,y <= 1e9.
Hi, actually I had a very cool idea. But its a little bit maths oriented :(
Approach : a should be of the form n*k+k. Now n*k+k<=x, then n<=(x-k)/k. Now iterate over k from 1 to x (say). answer will be incremented by min(n,y)-k, I did this because numbers which have k as the remainder and quotient will be in between k+1 and min(n,y). Now if min(n,y) < k+1, then you should break the loop because right value is smaller than left value. You can check using simple maths that you don't need to iterate for k more than sqrt(x+1) times check to get the final answer
C could be done with binary search too
Unfortunately, I have seen a similar task with C when preparing for our last round...
Sorry, we didn't know about that task.
Is C is really something so simple, or it is easy to google? :)
Because all I have thought is to try solve $$$a = (b + 1)ceil(a / b)$$$ and it led me to "iterate $$$b$$$ over $$$[1; y]$$$ and add to answer $$$min(x, b(b+1) - 1) / (b + 1)$$$". But ofc it's $$$O(y)$$$ :(
I literally submitted that: https://codeforces.me/contest/1485/submission/107226790
(and it TLEd obviously)
it's not o(y) because you only have to go until min(y,1e5).
I don't know how to calculate sum of $$$x / (b + 1)$$$ in range $$$[sqrt(y); y]$$$. I think there is formula but not found it.
After you pass sqrt(X), some values start to repeat (ie. floor(100/80) = floor(100/81) = 1)
You can split the code into two parts, one iterate from [1, sqrt(X)], doing the same thing you made:
For the rest, you could iterate on the quotient, instead of the divisor (ie. how many Z satisfy 100 / Z = 1?)
It will end up as a pattern like this:
So you will end up with another loop that iterate over sqrt(X) values, doing this operation:
Yeah, I've already done that 107235694
Silly me that not thought of it during contest
Great Round, thanks.
How to calculate Summation min(b-1 , x/(b+1) ) in C . b varies from 1 to y . Is there any other way??
No need to go till Y. Iterate on the remainder, the maximum remainder you require is 32000.
Observe that $$$min$$$ is only useful for $$$1 <= b <= sqrt(x)$$$.
$$$sqrt(x)$$$ isn't that high. So you can bruteforce the part with $$$min$$$.
For other values of $$$b$$$, just do a binary search on when $$$x/(b+1)$$$ changes. As there are around $$$sqrt(x)$$$ different such values (remember harmonic sum?) this would not be that bad either.
I kind of observed that , but thought it's C and shouldnt be that trickier. Knew that n/x yields same value for i <=x<= n/(n/i).
Was there some trick in D?
Yes. 720720 is lcm of numbers from 1 to 16, i.e. 720720 is divisible by any number in our matrix. further if (i + j)% 2 == 0 b [i] [j] = 720720 else b [i] [j] = 720720 + a [i] [j] * a [i] [j] * a [ i] [j] * a [i] [j]. chess coloring
Wow!
fuucccckkkk, I couldn't submit E because I spent the last 10 minutes debugging the fact that my ape mind didn't understand the tree input format
That tree input sucks.
It should be trivial to implement the parser.
It's actually my favorite way to input a tree. You can show that v[i] is also the parent of i, which saves you from doing a dfs to separate parent and child.
Kudos to problem setters. Short & crisp problem statements were great!!
Whoa, that was tough but fun.
A was a bit tougher than usual but OK. I felt B and C required really careful implementation (especially C). I solved as far as C and I can tell by the rankings that this contest was tougher than usual.
Couldn't crack D, was interesting though.
Again, I realized how bad my math is :(
I think problem F is easier and lighter(implementation wise) than usual. Otherwise, A pretty nice round. Thanks for the problems.
it sucks so bad when you realize how D can be solved after coding a dumb ass recursive solution and there is only 1 minute left.
For D. Notice that minimum number that divide each element is $$$720720$$$. We should make difference between adjacent elements equal $$$k^4$$$ for some $$$k$$$. Consider our matrix ass chess desk with white and black cells, so each white cell will be adjacent to black cells and vice versa. So we can set black cells equal $$$720720$$$, and white $$$720720 + M[i][j]^4$$$ what is less than $$$10^6$$$ and difference condition is met.
for $$$C$$$ the answer will be $$$\sum_{b=2}^{Y} min(X/(b+1),b-1)$$$. Can anyone tell how to compute this efficiently?
This is what I did: up until b=1e5 just apply the formula you mentioned, and after that it is clear that $$$X/(b+1)$$$ will be the minimum for whatever value of X, so figure out a way to efficiently do $$$\sum_{b=1e5+1}^{Y} X/(b+1)$$$
107225945 why my code getting tle ? explain me!
107221818 sorry exacly this code
Bruh. Because B is big.
but some code already ac like 107226318
He has break inside loop, you don't.
*didn't
because your sol is O(b * t) = 1e11 = TLE
ok thanks.
I corrected a mistake in my solution for E just two minutes after the contest was over, and then it passed the sample test case. I met such a situation again and again. o(╥﹏╥)o
Anyway, I'll try my best next time and wish myself to keep calm during the contest for better debugging.
Please Help Suppose I submit a correct solution of a problem and a minute later i again resubmit another correct solution of the same problem . Will the second solution get a penalty of 50 points because that is what happened with me today in problem A despite never having a wrong submission . Instead of 478 points I got 428
Yes, it does happen that way. Even if your original submission happens to be correct, (which is not something that is known during contest as only pretests are run) you still incur a penalty.
If I am not wrong, the only submissions that don't count towards penalties are
the first submission (not counting any compilation issues beforehand)
Submissions that fail to compile.
Okay !! Thank you very much
happy to help :)
Unfortunately, weak pretests for B.
wrong answer 80200th numbers differ — expected: '930343232', found: '576709456628597052'
I got FST on B for a very simple case which is when l==r, this type of simple cases should be present in the pretests.
I also got FST on B I forgot the case for n=1 , today I had the chance to become expert but I missed it :(
if i have 2 more min, i would AC B :(
Thanks for the great problems. What is the fastest way of finding any positive solution to $$$ax + by = c$$$?
see here https://cp-algorithms.com/algebra/linear-diophantine-equation.html
I am not too sure but doesn't linear diophantine only tell you if there exist some
a
andb
. not necessary positive a or bBut you can always shift the obtained fundamental solutions to obtain both positive x and y if they exist in O(1) time.
My bad.
It's too late to hack in contest, but CM's and above can uphack, which would add the test for future upsolvers. It won't change anyone's rank in contest, but it's still useful (not to mention fun). If you send me the submissions and the hack test, I could uphack them for you.
test case 26 has n = 1.
so no, not a "lotta solutions" fail to cover n = 1.
like task D
Dear Kaey, I am very sorry that I complained irrationally about math today. I may have hurt your feelings unintentionally. I may have disrespected your hard work. I didn't want to do that. I loved today's problem set. I deeply appreciate your hard work. As I suck at math and I didn't have anything to do, I irrationally started trolling you guys without thinking a bit. But one of my friends made me realize that I was very wrong. I am extremely sorry. Please accept my apology. I hope to see you guys set more awesome contests like this! Thank you.
Easy D (1750), LOL
D feels like aprils fooling if not solved :/
Just chess coloring of 720720 and same number minus
a[i][j]
oughh... Pleeassee make pretests hard :'( it hurts so much
$$$\lfloor \frac{a}{b}\rfloor$$$ forces
Nice contest..... I like that there are hints in editorial before giving out the solution
Don't know about others, but coming from a math background, this contest was really enjoyable. Kudos to all the authors! :)
A-D are math problems
Can anyone tell why B failed on System Test 5?
Check when
b
is equal to1
, e.g.Can't believe I missed this case. Anyways thanks a ton for help!
Thanks for good pretests in B...
if I read D before C, I would AC D :( Why in this contest D is much easier than C?
Thanks for the contest :)
I tried to calculate $$$Dp_i$$$ from bottom to top in problem E, but got wa on test 3. It works like this:
Where $$$i$$$ is the depth. The nodes in $$$stage[i]$$$ has the same $$$dis$$$ which is $$$i$$$.
$$$minn$$$ is the minimum of $$$a_i$$$ at the same stage, $$$maxx$$$ is similar to $$$minn$$$.
Could anyone explain that why it is wrong? The submission : 107250435
Hello everyone, this is my first time making a tutorial if you like then please like and share and if there is any concern then please comment: https://youtu.be/fMZIuQU7fqY Solutions for problem A,B,C,D
Why have the recent rounds started adding so many Adhoc, Math and Constructive questions? We should have more DP, Graph, Range Queries etc.
A very cool problemset. Thanks.
108588783 108606146