As-salamu alaykum, Codeforces! (Peace, Codeforces!)
We are glad to invite you to Codeforces Round 673 (Div. 1) and Codeforces Round 673 (Div. 2), which will take place at Sep/27/2020 18:05 (Moscow time) (notice later time than usual). The round is rated for both divisions. Each division will be given 6 problems to solve in 2 hours.
Problems were prepared by nkamzabek, bthero and me DimmyT.
We are very grateful and would like to sincerely thank the following people for their assistance in preparing the round:
BledDest for the brilliant coordination of our round.
adedalic, kdjonty31, Prakash11, namanbansal013, RockyB, Retired_cherry, saurabhyadavz, morzer, Mohamed.Sobhy, coderz189, hugopm, Tlatoani, dorijanlendvaj, and Roms for testing the problems and providing helpful feedback and suggestions.
MikeMirzayanov for the amazing platforms Codeforces and Polygon.
This is our first round, we hope that the problems will be interesting and that the round will pass without issues.
Score distribution:
Div2: 500-1000-1500-2000-2500-3000
Div1: 500-1000-1250-2000-2250-2750
Wish everyone good luck and high rating!!!
UPD: problem ideas
UPD: Editorial Out
Congratulations to everyone, contest passed without issues!!!
Div1:
Div2:
Hope that your first round as a setter will be flawless.Good luck DimmyT.
Thank you!!!
The presets were weak for Div2-B. Please make strong presets from next time.
It was flawless and really good
As a setter, give me a contribution please)
If you want a contribution, why didn't you write announce?
Because I did.
Не душите аби
.![meme.png](/predownloaded/25/74/2574f41b2a6d0f6a8ed1f2744afc8d9e955d6b39.png)
posted
How was this blog made 7 weeks ago?
I guess its because He started writing the blog 7 weeks ago and posted it today
Shhhhhhhh
Just kidding, everybody here knows that you can travel back in time
Because, in Kazakhstan, we have a time machine which can take us back for at most for 7 weeks.
wait!! still you are orange. (as you can better your previous contests by going back in time)
Proof that orange is the best color.
Yes
I made this comment long ago, when I was young and foolish. I have since changed my mind on this topic. Truly red is the best color.
congratulation for getting red!
But you are red now ORZ
Sounds like beginning of a problems.
DimmyT Will I reach you? I hope I can reach you...
Reference: See my profile picture and the problem setter's. Also, I do want to reach Master. :3
A man's dream will never die!!!
P. S. Just don't know how to react that.
clash with CodeAgon 2020 (Codenation coding challenge) https://www.interviewbit.com/contest/codeagon-2020/
just saying :)
I can't do anything with that...
you have time machine you can do anything ORZ
Good luck to everyone and thanks the authors for the contest!
DimmyT Please BOLD or HIGHLIGHT the unusual contest time .
Done
Do you really think that the bold rated will stop inquisitive people from asking "Is it rated?"?
Wa alaykumu as-salam
Wa alaykumu s-salam DimmyT
Oalaikumus salam
lovely to see salam... Walaikumussalam
Oya-laikumus salam DimmyT,, hope the Div-2 round will be very interesting ❤
All of the setters have participated in the IOI selection camp this year
bthero has won IOI 2020 silver medal! orz
I think this round will have interesting problems and of course I recommend everyone to participate.
Good luck to the authors with your first Codeforces contest!
This year, I was weaker than last year
That's age-related cognitive decline. lol
I am only 18
Another sad fact?
Am I too old?
This is clearly an early onset Alzheimer's.
Cognitive decline actually improves CP performance.Wa alaikum us salam.
[user:DimmyT]
Very very good wishes for your first round.Good to see a round from the Borat country_****_
Number one problems in the region!
Why have you tagged this round as cf666 ?
Why not
P.S. I can't change tags
A best of luck to all from this baby panda :)
what is the division rule in parallel div1/div2 round, because i am seeing that some experts are registered in div1 and some master are also registered in div2 too so am i little bit confused can anyone explain
![](/predownloaded/79/e1/79e111b4f523af92165e5462d4f2675384b16620)
register started before last rating update.
maybe that or those masters doesn't wanna participate in rated contest..so they registered in div2
in parallel round there is no case of unofficial participant, contest is rated for everyone....
Hope that I will become specialist after this round.
hope that i will become candidate master after this round :( +111 rating
Good luck and high rating!!1!
For those too lazy to click 15 times it says Good luck and high rating!!1!
this contest time is very good for me.
Walaikum-assalam...waiting for your first and hopefully nice round.and also hope i will reach my top rating ...
waiting for score distribution
Wa alaykumu s-salam!
Good luck to everyone!
Will score distribution publish after the contest?????
Hope for a better Rating for me and everybody :) keep practicing!
Less than 90 minutes until the round starts.. no score distribution yet?
UPD 1: Less than 60 minutes, no score distribution yet
Less than 45 minutes, where's score distribution?
UPD1: wait, they finally posted it.
As a contestant, I would like a cake.
I just ate cake. What coincidence :D
thanks again to MikeMirzayanov to for creating, developing, and maintaining the best websise of algorithmic problem ever. and my congratulation to you, DimmyT, for managing a team to creating contest and I hope that will be one of your best experience.
thanks again for your efforts.
Actually, you should give credit to nkamzabek for managing a team.
DimmyT how many shared problems will be?
I think 4
Actual problem ideas
"UPD: problem ideas"
got trolled by this in the update.
Original Song is so inspiring!!!
ThatDude's cover is good too.
Won't deny that:)
This is my first time I solved a div2 probelem during a contest. Yeah!!!!!
hello all ,can someone explain me , why my rank dropped ,the moment i submit the same code for the same problem after sometime tho it was already passing the pretests successfully?
its a rule of Div 2 ...last accepted submission is considered.
I'm really disappointed I took my time thinking in C but couldn't see the solution :/
What do you mean by "see", do you mean "without getting the solution"?
What was the point to write it in the comments? You wanted to show everybody how stupid you are? Well, mission accomplished dumb ass
if someone couldn't figure out the solution of some problem that doesn't mean he's stupid most of the times I can solve C
what's the point of your comment? to show me that you're a piece of shit ? Well, mission accomplished dumb ass
Bruh, why do you still green-piece-of-shit if you've already participated in 200 rated rounds
I'll come back to cyan soon don't worry no wonder why your contribution is -7 because you're a jerk
at least, I participated in less than 150 rounds, and I have higher rating than you, and I don't cry because of unsolved problem
there are others higher than you so what's the point ? does that give you permission to talk down to others should tourist come and write to you orange-piece-of-shit and I'm not crying it's just a comment that expresses what I feel WTH do you want from me
OK, I think guys, that have higher rating then I and had participated in less rounds than I are really cool. I want you to delete all your useless comments, because people here don't give a fuck about how you were thinking in div2 C and didn't solve it. You have just to work hard and don't write this shit in comments.
I don't think I should take advice on what I should I write from -7 contribution asshole make your contribution more that 100 then speak
Oh yeah, if u think that contribution shows the level of your IQ, than u r really stupid
Can you complete a sentence without saying bad words?
There are many of codeforces users who have not yet completed the age of 13 and you are affecting them with your speech.
well it shows how good your comments are and your comments sucks
so you think tourist is cool well you're right he is cool but does he talk like you ? No he never told someone you're bad because he isn't a piece of shit like you
impermanence how old are you lmao.
8?
OK
Sure
And I really don't give a fuck about my contribution:)
In Ukraine we say:"Не кажи гоп, поки не перестрибнеш", and i think it's beautiful.
In Ukraine "Kyivstar" bans Codeforces, and i think it's beautiful.
If you can't solve problem, it is your fail. Your comment was stupid and useless. You have better go and upgrade your skill.
I'm sure in real life you look like your profile picture
ахаха чел на риал лайф сразу переходишь та куда
иди на хуй себя
savage.......
Really guy, why do you write this comment? What are you waiting for? You simply write shit into comments, and because of you and guys like you comments section have a lot of useless shit instead of really important comments.
so all of the other comments are full of useful information ? let's see one of your comments
you should create problems on mathforces, not codeforces. well that was really great comment ... but it's better if I didn't read it
Don't react to these negative messages. These guys are just provoking you.
You're right I won't next time they're just trolling
nice score, awesome D...
That was stressful, wow.
In Div1C, was it intended to disallow $$$O(n \log n \log C)$$$ solutions? If so, it would've been better to make it explicit with setting $$$n = 10^6$$$ or something.
I was also stuck at this the whole time.
my o(nlogc) get tle
My $$$O(n log C)$$$ solution using unordered_map TLE for a few times.
In my experience "$$$O(f(n))$$$ with unordered_map" in practice performs more like $$$O(f(n) \log n)$$$.
I was able to pass with the same complexity using gp_hash_table
https://mirror.codeforces.com/blog/entry/60737
Now hacked by test case 44
Unfortunate :(
A question: does the test case just force a lot of hashmap accesses or is it specifically made to kill pb_ds
I think it is specifically made to kill your simple hash.
https://mirror.codeforces.com/blog/entry/60737
PS. The hack is not made by me so I just guess.
PSS. I just realized the blog is shared by you first.
In this post it said:
A better hash function ...... I used hash function in the post to get AC now.
Time to fix my template... :p
Agreed, time limit was definitely not fun, I only got AB because of starting C too late and not giving myself enough time to optimise at the end :[
My solution worked pretty fast. Also, the intended solution was $$$O(n log C)$$$. My solution: 94020968.
Not allowed to view the requested page :/
I'm sure the intended solution was $$$O(n \log C)$$$, but in the case of borderline complexities like $$$O(n \log n \log C)$$$ it would be nicer to have time limits and constraints that make it clear whether it passes or not. Currently it seemed clear that $$$O(n \log n \log C)$$$ would pass, but in the end I found out that it doesn't.
it works ~200ms. But the same solution with trie structure works much slower, so to make it convenient for other languages, we made such a generous TL limit.
My solution
My own hashmap $$$O(NlogC)$$$ runs ~$$$400ms$$$ lol.
Awesome! I used your template to get AC and added a convenient func works like iterator for it. May be useful for you next time.
https://mirror.codeforces.com/contest/1416/submission/94041210
Should ideas rather than optimizations.
The intended solution should pass pretty easily
my O(nlogc) solution took 1.8s(I noticed this 10minutes after passing pretests) in pretests.Since it was very close I didn't want to take risk.I had to constant optimize it and resubmit losing a lot of points in the process.also got mle once just for using long long instead of int.imo in trie problems ml should be higher.like 1-2 gb
My solution uses pretty small amount of memory. My implemention with trie pass easily too.
Yes my $$$O(n \; log \; n \; log \; C)$$$ using mergeSort failed but passed in 2386 ms in mashup :(
why is my contribution -1? what did I do?
You posted this comment without formatting code and without hiding code in a spoiler tag.
Okay. I didn't know that. I am new. How can I now make my contribution non-negative?
My suggestion (this goes out to everyone who has negative contribution and doesn't understand why): lurk the blogs and comments here to get a feeling about which comments and blogs are welcome. And only once you understand, start commenting yourself.
WA 6 times.
Div2D pretest 2 is literally mocking at me.
And the fastest editorial publisher award goes to DimmyT
Actually to bthero $$$orz$$$
Can someone please explain the wrong strategy in my d2c ans : Store the indices for each value and then find the minimum value of k for which this fits by binary search. and then manipulate the answer array with left to right traversal.
Regarding binary search I got a pattern that for each indices in kth supposed iteration its supposed count is min(i, k, n — i + 1, n — k + 1) then I binary search on the value of k.
submit F in last 5 seconds and find my output is following:
instead of
Hope my solution is wrong XD
OK, I got WA. I think I should learn more hard (>__<)
Cornercase for Div2D: it is possible that we can't subtract anything from such ai that ai<i and this ai is more than sum(a)/n, but we can add to it i-(ai%i) from a0, so solution exists in that case
Also, I've been struck for a long time thinking what if i-(ai%i) > a1. But since at any point say we are at index i, a1 must contain atleast i-1 (as initially all elements >=1). And i-(ai%i) cannot be greater than i-1(since i doesn't divide ai). Hence, the non-negative condition holds. Nice problem.
Div1B : The initial value of a_i IS NOT 0
haha....
That one totally got me, I kept thinking that raising a[i] up to i's multiple may cost a[1] become negative...
happened to me too :(
got OK on D with 1466 ms with sets in $$$O(nlog^2n)$$$
how to solve it properly?
UPD: resubmit of the same code in upsolving results to 1231 ms. got "lucky".
You can read editorial and solve it in $$$O(nlogn)$$$
Tonight may be the second time I turn blue. My performance tonight is not good. After finishing the first three questions, I looked at D and didn't have any thoughts, and then I looked at E and I didn't even think. Finally, I came up with an algorithm for the number of operations for question D of 2*n, and submitted it at 01:52. But returning to the wrong answer, I reviewed the code and found a bug, but there is no time to change it. If you give me half an hour more, maybe I can pass it. I also want to be a candidate master, but I know this is not realistic. The realistic goal is to stay blue for the next few rounds. It's incomparable to a god who can turn yellow or red in a few games, and I am satisfied with that. I don’t have any acm and oi experience. I’ve been in contact with codeforces for four months. I can’t even solve div2a from the beginning (yes, I tried div2a for one round, but after trying for more than an hour, I still didn’t get ac. There was no way, I had to look at other people's code, and finally passed this question.), This is my first experience of doing the question in codeforces. By now, I finally solved some problems. Having said that, I hope everyone has good luck and a good rating, and most importantly, make progress on codeforces.
You can do it!!! Before I finally became a Candidate, I almost fell to Specialist.
What is wrong in the solution of D. (Div 2)
UPD: Found my bug. Thank You all.
I must say the problems were very good!
This contest is great, thank you for your encouragement.
please help why my logic of two sum is not working for problem B My Code
I tried your code with the following input and got the wrong output. In the result, the two groups would be "1 4" and "1 4", and clearly there is a pair that adds up to 5 in each group. The correct partition should be "1 1" and "4 4"
You would want to be consistent in the partition of numbers — by which I mean if one 4 is given to group A for one time, you'll also want it to be given to group A when it appear for the second time. The way I did it is to:
and treat "number = half of the unlucky number" as special cases.
Hi, why we need to place in same group.. can you please explain me why we need to be consistent in partitioning.
If you have "3 5 5 3 3 5" and the unlucky number is 8, and if you put 3 into group A the first time and into group B the second and the third, it would be like:
But in this case both of the group contain two pairs of 3-and-5, which adds up to 8.
A better solution is to partition this into:
In this case no 3 and 5 are in one group.
****i think you should make strong pretests..**** btw good questions great-
yes , you are right , pretests are soo weak
You being hacked does not mean pretests were weak. It just means that you sent an incorrect code
my answer had not been hacked , it passed pretests but wrong answer after system tetsing, so please have correct knowledge before saying something
Same shit. It does not mean pretests were bad
can someone help me find why it FST in div2b[submission:93982376] thanks
One of the problems I see is you seemingly have uninitialized c when k%2 == 1
On line 39:
if you put "if(a[i]>=k)" instead of "if(a[i]>k)",then both all numbers bigger than k and k s themselves are automatically labelled 0.
However, the numbers could also contain 0, and thus 0 and k are both labelled 0, according to your codes.
Best luck next time, Kanshan.
Oh.thank you . i remember that ai is greater than 0. apparently I was wrong
but in that case. k were not in mp. so 0 will be labelled 1.
sorry I find that when k is 0 I will get wrong
What about div-2 B
can some one give me some idea for that
Thanks in advance
Try to partition the numbers into two sets in such a way that for a number $$$x$$$, $$$x$$$ and $$$T - x$$$ won't belong to the same set
If both sets contain $$$T - x$$$ go to the set with the minimum count of $$$T - x$$$.
Submission: Link
How long will rating be updated after the game?
1 day I think, after the Hacking period
This was a div2/div1 round. So, no hacking period.
Wait, hacks are supposed to be done during contest...? I never did any hacks before so I thought it's after, sorry for that. But the scores are indeed updated one day after the contest, right.
No, ratings usually update about an hour, or two after a div1/2 contest. By the way, FYI hacks will give you points in div1/2 rounds.
Congrats Ashishgup
Orz
Ashishgup sir becomes Red today . Heartiest congratulations to sir !!
Thank you DimmyT, this contest helped me to get Specialist