Мы с blyat рады пригласить вас на Codeforces Round 669 (Div. 2), который пройдет в 08.09.2020 17:35 (Московское время). Он будет рейтинговым для всех участников, чей рейтинг ниже 2100.
Задачи были придуманы и подготовлены blyat и i.e. Мы хотим поблагодарить всех, кто оказался причастен к этому раунду:
antontrygubO_o за координацию раунда и высокое чувство вкуса, благодаря чему у нас получился отличный контест.
talant, Tlatoani, hugopm, Keshi, jouIej, jo_ulej, dick, Ari, AmShZ, rip, Devil, morzer, baby_baby_baby_ooh, Prakash11, Retired_cherry, Programmer, saurabhyadavz, _overrated_, LordVoldebug, LordVoIdebug, NiceClock за качественное тестирование раунда.
MikeMirzayanov за платформы Polygon и Codeforces.
У вас будет 2 часа на решение 5 задач, одна из которых будет интерактивной. Вы можете ознакомиться с руководством по интерактивным задачам здесь.
Отдельное спасибо хочется сказать моему замечательному минипигу Швайне, который вдохновлял нас в течение всего времени подготовки задач.
Разбалловка будет ближе к началу контеста.
UPD1: В условиях не будет картинок с минипигом. :)
UPD2: Разбалловка: 500-1000-1500-2000-2500.
UPD3: РаЗбОр
UPD4: Поздравляем победителей!
Div1 + Div2:
Div2:
Автокомментарий: текст был обновлен пользователем i.e (предыдущая версия, новая версия, сравнить).
Auto comment: topic has been updated by i.e (previous revision, new revision, compare).
Hats off to you @ antontrygubO_o
while(true) laugh();
epic programmer moment
Bruh , Thanks for hiding the pig in the spoilers , that pig was giving me nightmares
Thank you , or in japanese , Ari gato , hoping to become a good Programmer
Hey, I understand that you want to make a point, but don't you think tagging is unnecessary? I believe noone likes to be tagged just to see themselves being used for a pun.
As a tester I would say that, the contest is really well prepared and the questions are awesome.
antontrygubO_o orz.
He is hero of Codeforces
you forgot the "as a tester" part... could have got you loads more contribution xD
Done. :)
;)
and yes, antontrygubO_o orz
So let me get this straight ,
This contest was tested by dick , I hope we don't get F@cked
Why is LordVoldebug mentioned as a tester twice?
Tested it twice for "high quality testing".
that's different users:)
one user with two different handles or are they actually two users?
LordVoIdebug & LordVoldebug, i think the difference lies in I & l.
Maybe it's a bug. It's in his username after all.
i have a night now i scared about picture))))) thanks)
My EYES, My EYES !!!
Why is Putin2024 a tag?
Why is Putin2024 a tag?
Because 2024 is a year, when Russia will choose president. Putin is Putin u know
putin2036
No such pics in problem statements plz
*pigs
To be honest, I was scared by the minipig Schweine when I opened the website. Will he be the hero of the problems? I'm looking forward to it(I love interesting background)!
what a terrible day to have eyes.
istg if you look straight into the eyes of the amazing minipig Schweine you'll have goosebumps.
I peed myself looking at that
Можно эту свинью вставлять вместо скримеров, такой ужас
сам свинья это минипиг сказали же что за неуважение.....
Is this pig the protagonist of the stories in the oncoming round?
Please don't put a picture of the minipig in every problem statement.
I hope we don't have a picture of the minipig in every problem statement.
My new sleep paralysis demon
Yeah, but no matter what, this minipig can't be any more demonic than the LEGENDARY PONIES
Truth!
[deleted]
Its a digon my friend, not a monogon
Opening the site and this minipig is the first thing that comes out to eyes lol. Really looking forward to see him as the theme hero if turns to be so!
That picture is terrifying,please no such pictures in problem statements.
minipig
Oh god! That's terrifying!! Please delete this.
I think, this is better
Can you please put your amazing minipig under the spoiler?
Why people are being dumb and stupid, and overreacting to the picture??
lesson learnt, i wont post shit again, sorry
lesson learnt, wont post shit like that again
Good ideas of problems you've prepared! Each is worth tasting.
A very cute pig =))
Get a good night's sleep after look the amazing minipig #_# 1h a.m here
Can someone please explain to me why my friend who had rating 1479 before contest got +37 after achieving 3025 rank, and I only got +10 since I had lower rating (1470) than him, and got higher rank than him(2744). This thing is not letting me sleep. Please respond if anyone knows about this ??
Maybe, this post can help you.
If your friend new on codeforces, then his principle of rate-counting may vary with your for some rounds.
That because the predictor not computes your result right away. 2 minutes per time may be.
I don't understand. Can you please explain?
There is an extension for browsers called cf predictor. It is useful to know your approximate rating change before the actual rating change. NeiH thought that you're talking about its results.
But still I didn't get why I have less rating change then my friend?
I think it is only because it is his 5th contest. Same happened to me and my senior (although on Atcoder). If both of y'all had 15+ contests then i'm pretty sure he'd get a lower delta than you.
MikeMirzayanov I think this pic is too much...
pic that is too much is already deleted
i.e's comeback after their drop to specialist is my motivation.
Can somebody tell me what is an interactive problem?
those problems in which the code interacts with the in real time. When we develop a solution for an Interactive Problem then the input data given to our solution may not be predetermined but is built for that problem specifically. The solution performs a series of exchange of data with the judge and at the end of the conversation the judge decides whether our solution was correct or not.
You may look here............
This link was in announcement section....
Is number of user increases or the people uses multiple account ??
I was going to participate in the contest, but now I've seen that pig I'll better lock myself in my bathroom
Bathroom quarantine
It will be another nice interactive problem :))
Thanks for Reference of
how to deal with interactive problem
to learn more about interactive problem see the question of long contest in codechef that always have 1 interactive problem.
We want to know.
.
scary pig
As a minipig, give me contribution
wait what?
the contest is really well prepared and the questions are awesome. :)
The pig makes me want to skip the contest...
Good luck!
![ ]()
as coautor and creator of deleted offensive meme I want dislikes and harassment charges on twitter
"UPD1: There will be no pictures of minipig in the statements. :)"
So sad. I think I'll have to skip the round then.
I hope I would become expert in this contest :)!!
same bro
That pig looks hideous.
This picture is so scary!
I was so scared!!
MikeMirzayanov This is too much.Please delete this pic.
Sorry for off-topic but why hasn't ratings for the last round been rendered back again yet?
PS: Ratings are back now
No scary pic in problem statements plz.ToT
Chill dude, check UPD1 in the announcement
Why is this picture here??
i fear the demons that possess the problemsetters.
This pig is causing PTSD.
The picture should be removed imo. Maybe it's some kind of meme and maybe it's funny for some people, but I don't get the picture of the pig. I might be overreacting, but it's extremely disturbing to have to see it every time I scroll through codeforces home page. After all, this isn't creepypasta.
I was not sure about registering for the contest but after the pig appearing in my dreams for two days straight I am glad to say I'll be losing my score today :/
Thanks for putting the pig picture in Spoiler, that's so much better!
Oh, thanks for delete the pic.
You should have also added, "Resemblance to any living or dead person is purely coincidental." Unless I am mistaken in identifying.
I hope interactive problem will be nice :) and good luck everyone for the contest.
After so many ups and downs i am hoping that my rating increases. :(
I made the mistake of clicking on the spoiler 10 mins before the contest. Now, I just have to hope that it won't haunt me during the contest :/
First problem is literally laughing at me
Is it just me who is feeling the questions to be more difficult than usual?
:)
I think we all overthinked problem A.
When I start practising 1500 rated problems then I'm unable to A,B problems in contests, When I practice A,B level problems then I'm unable to do 1500 or more rated problems. Any solution anyone? :/
Practice both.
Unclear question 1407B - Big Vova , I couldn't understand what lexicographically maximal is.
In the clarification, it says "a is a prefix of b, but a≠b" I don't know when a is called a prefix of b. It would be great if Authors could give example to make things clear. Long and unclear question.
will you please check my submission 92286136? I can't figure out what's wrong.
Try this test:
Is D DP?
I don't think it can be solved with DP because you can also move backwards.It is a simple BFS the hard part is constructing the graph.
It's given in the question that we can't move backwards
i solved it using dp and monotonic stack + a BST for transition
Thanks I kept thinking but couldn't implement in time!
Yes see this for O(N)
Even if solution of A is $$$O(n)$$$ why constrain is so low?
Cause problem name
Ahahahahahahahaha
I love so much when I understand the exact task just 5 min before the end
How to do problem C?
Keep the index that corresponds to the highest value among the numbers you looked upto now. Send two queries "? i biggestIdx" and "? biggestIdx i". If the result of first query is smaller than the second, you should update the biggestIdx and before doing that you should update A(biggestIdx) with the result of second query. Otherwise, update A(i) with the result of first query. Finally, you know that A(biggestIdx) is equal to N.
if a % b > b % a, then a % b equals a, otherwise b % a equals b. it also tells you which one is bigger. any time you ask you save the one you got and compare the next you don't know with the one you are left. so you can do this n — 1 times, the position you are left corresponds to the number n.
if you pick two distinct numbers a and b, and ask a mod b and b mod a,you can find the smaller of the two numbers.keep repeating this until you find n-1 numbers and the final unknown value would be n;
Why only N will be the remaining value?
because you always find the smaller number when you compare both the mods,and N is the largest number in the permutation.
Ohhhh... Nice observation... I got all the idea but was not able to observe that N would be the last remaining number.... Did a O(N) loop to find out :)
Similar problem to today's problem E: https://dmoj.ca/problem/ioi11p4
Should have not attempted this contest....Bad Day :(
HAHAHA
, this round wascursed
.You've nothing to lose.
Personally this is the hardest contest I ever had.
Can some one tell how to solve A and B after the contest?
For A if the number of zeroes is >=n/2 then just type out n/2 zeroes.Otherwise it means that the number of 1 is greater by at least 2 than the number of zeroes so you write out n/2 ones or n/2+1 ones depending which of those is divisible by 2.
Problem A is very nice for its position. Well done.
If constrain for n were of order $$$10^{5}$$$ then would be more nicer.
i smell the sarcasm here and totally agree
I guess sarcasm is hard to convey in a comment. A is truly one of the better problems I've seen at its position because I had to think for more than 15 seconds to solve it.
Smn plz check my solution on B https://mirror.codeforces.com/contest/1407/submission/92280369 I don't know why it fails on the second pretest
The interactive one was nice...
Nice Problems
Always being a tough too solve a interactive problem
Problem A killed me, 3 WA and 22 minutes to get it passed. It was my mistake thought :\
Someone has hints for D?
There are only $$$O(N)$$$ possible transitions, find them by placing building in increasing/decreasing order then the DP/BFS is trivial.
Shouldn't there be C(n,2) transition while it's only possible to move forward?
No, place the buildings in increasing order and consider the closest building to the left and to the right. It can be proven that every transition will be found by this constructive algorithm. So there are clearly at most $$$4N$$$ transitions.
If you have for example 4 2 2 2 2 4 4 4 4 4 4 4 2 it is faster if you move backwards, you can reach the end in 3 steps.
No, as much as I have understood the problem for an input like
4 4 4 4
the answer must be 3. You can only jump between i & j if and only if the middle elements are strictly greater or smaller.I kept two stacks where one of them shows the indices of increasing sequence and the other showing decreasing sequence. Then, made binary searches over these stacks and used Segment Tree to get best option among them. However, I got WA at the 5th case and I don't know why...
I used two monotonic stacks to record the indices of increasing sequence and the indices of decreasing sequence, respectively. Iterate height from n-1 to 0.
The same idea as ur, but WA on the 5th case...
See this
For DP in O(N) with increasing — decreasing sequences.
problem A is too hard
Anyone willing to help my submission for div2 qns C. Did the flush and follow query format but still cant pass. Thanks
I think you messed up with indices when assigning arr[idx1] = smth. That should be arr[idx1-1] right??
Idk but that's what ig is wrong as I hv the same soln in C++.
Hmm.. Now, I'm interested to know how Mr. Kinky Pig inspired this conspira- um.. contest.
Nice problemset btw.
Round gave me PTSD.
Took 36 minutes for A, 8 minutes for B. Life's weird.
kinda same with me, 28 mins for A and 11 minutes for B.
Story of this contest:
Has anyone solved D with $$$O(n * log(n) ^ {2})$$$ solution. I got TLE.
Can you tell me your idea. I tried to solve using binary search and segment tree, my solution complexity is also $$$O(n*log(n)^2)$$$ but got not getting correct answer.
Actually I thought like $$$dp[i]$$$ is the minimum steps required to reach $$$ith$$$ index. Now there are cases if $$$h[i] > h[i - 1]$$$, $$$h[i] < h[i - 1]$$$, or $$$h[i] = h[i - 1]$$$.
$$$ Let$$$ $$$dp[i] = 1 + dp[i - 1]$$$
if $$$h[i] = h[i - 1]$$$, then do nothing
$$$if(h[i] > h[i - 1])$$$ then, find the first index $$$i$$$, let's say $$$j$$$ such that $$$h[j] >= h[i]$$$, and also find index $$$k < j$$$, such that $$$h[k] < h[j]$$$.
$$$if(h[j] == h[i])$$$ then $$$dp[i] = min(dp[i], 1 + dp[j])$$$
$$$else$$$ $$$dp[i] = min(dp[i], 1 + min(dp[k + 1], dp[k + 2], ..., dp[j]))$$$
similary handle for $$$h[i] < h[i - 1]$$$.
I think this is correct but IDK why I got TLE.
see this for O(N)
Is it just me or the implementation for Problem B was very hard?
B was easier then A xD
https://github.com/actium/cf/blob/master/1400/00/1407b.cpp seems pretty simple (maybe even easier than problem A)
https://www.youtube.com/playlist?list=PLBqHLq3IFiRLBB96TUEoxBvP80s73uSPo
Do visit the editorials of all the problems given .
I'm really sad I got C solution idea but couldn't code it in time :(
A is cool, but cursed
Pupil to Specialist...Great Contest.
https://www.youtube.com/channel/UCBStHvqSDEF751f0CWd3-Pg/
Subscribe to this channel for all editorial videos .
Missed that the length of the array is even in A, wasted 30 mins. Maybe authors should bold important info in the question itself rather than in the constraints section.
Am I the only one who thought problem A required an output of even size... My mistake ofc but just wanna know if I'm the only dumb here lol....
Today's div2A problem was the most perfect div2A problem I have ever seen in any CF div2 round.
It would have been better with the test : 8 0 0 0 1 1 1 1 1
Why?
The answer is just $$$1 \ 1 \ 1 \ 1$$$.
My rating after me solving A after fourth attempt:
You are not alone, for betterment of my mental health and physical safety of my laptop i headed out of the room after first WA.
In today problem C I have submitted O(n) solution in pypy3 it got TLE in tc 6 . Again I have submitted almost same solution and got an AC in 997 ms . I have seen most of the pypy3 codes getting execution time above 900 ms .
But then I have coded it in c++ as it may get TLE again in the systests and got AC in around 300 ms. This is not only today that I have faced this kind of problem , I generally switch to C++ in case of any problem involving recursion . But how may I know that an O(n) can also get TLE .
So to all the respected problem setters please check if the python solution is accepted with a considerable margin or just increase the time limit.
The issue with python is that it never take a fixed amount of time for running a piece of code, running the same code multiple time can sometimes yield different results. This is not just on codeforces but many other platforms also faces criticism for uneven time limits of python but you see its really not in their hands because increasing time limit can make unintended brute force solutions pass the system tests. You can correct me if I'm wrong.
I am not blaming them . I just want to say they should check if the python solution is getting accepted with a considerable margin . If not they can just increase the time limit by some milisecond . 1 to 1.5 or something like that.
They clearly can set TL by language which they dont
Problem with python programmers (who do CP) is they only know how to whine about time limit. First of all, you use not the best tool for a task(python instead of c++/java) then you complain about things not being same for you, like WHAT?
Also there are many high rated python coders, so clearly things haven't really been unfair, you just don't know python enough for CP. Either learn python more indepth, understand all intricate and subtle things about it then use it for CP (you won't need to complain then) OR use a more appropriate tool(C++/Java/Rust/..)
I agree with you that this interactive had kind of a tight time limit.
It is possible to pass just using the default PyPy IO 92228274 (951 ms), but the TL is tight. Important to note is that the built in IO in PyPy is far slower than CPython IO. The same code in CPython runs in 655 ms 92292022. The work around for PyPy is to use a drop-in fast IO template 92308464 (670 ms).
About your code 92261279, there are two ways you could improve it.
Don't import a crap ton of stuff that you don't need/use. Your unused imports at the top take like 150 ms in PyPy3. Also by doing
from math import *
you are overwriting the very useful built in pow function.You can make use of fast IO templates like this to greatly speed up the IO in PyPy.
With both of these improvements your TLE code runs in 748 ms in PyPy 92307825.
As a final remark, it is possible to get below 300 ms even in PyPy 92288195.
Edit: case was wrong nvm
I didn't understand why (4->5) is incorrect. I think the answer will be $$$1$$$ for this test case.
Oops apparently I was too salty to think of cases properly >.>
so 4->5 should be feasible
In question A div 2 We can not remove consecutive elements so for case 4 1 1 0 0 Why answer's (1 1) and (0 0) are getting passed , Since in both cases consecutive elements are getting removed.
Statement says "The elements that you remove don't have to be consecutive."
They might or might not.
This was my first interactive problem which i had tried and got wa only for using long long variable..Is there any restriction about using long long at interactive problem???
Sorry i don't know about that matter.
Thank you kindly for any good response. @realhype
Nope. I use long long everywhere and got AC in C
it is saying that y is out of range because your program is asking x == y and you cant do that
"? x y" (1≤x,y≤n,x≠y).
Nope not for that.I was so foolish and i used %d while i was using long long. Later i fixed that and got ac for both int and long long.
Maybe i tried the wrong program anyway , good job
Who could tell me the correct algorithm to solve Problem.D ? Thanks!
What to do if one dosen't get the logic, like me in problem A.?
Skip the problem.Do the others and comeback.Each person can probably solve questions upto slightly above their rating. By that logic I usually try up until D, many a times skipping questions I didn’t get in 10 min.Today is a good example. Didn’t get A in 10 min, so skipped it, did B and C, came back to it, it worked out.
In div2C, I got system test failed, submitted in C++17 and now even sample test is not passing for that solution(if it was shown during contest, I could have tried to correct it). While when I submitted the same code after contest in C++11, it got Accepted. Why is this weird behaviour? i.e, blyat
Link for WA(C++17)
Link for AC(C++11)
https://en.cppreference.com/w/cpp/container/set/erase — "References and iterators to the erased elements are invalidated"
After you do
st.erase(a)
, the memory location thata
points to is no longer valid. Socout << (*a)
can print non-sense. Get the value before erasingOk I got your point, but then why same code in C++11 is giving AC. It should also give WA.
undefined behaviour. Guess you got lucky cuz the old compiler decided not to overwrite the freed memory
I don't know good or bad but why was Problem A laughing at me :sob:.
Good problems on math.
Bye, my rating..Even if we know each other for less than a day, I still miss you from time to time.。
Hello everyone,
I received a strange runtime error on TC 10 in today's Problem B — "Big Vova" in pypy2.
Here's the link to simplified code, 92298672
But after adding a useless line to the solution it got accepted. Which was:
Link to the accepted solution, 92298831
If you read my code, the above snippet never gets executed according to my logic.
I am confused if this is pypy2 fault or cf. There were few other python submissions that had the same problem like this one for example 92244789. If anyone of you knows what's happening please do let me know.
Link to my original submission during the contest 92248591
I would like i.e blyat to see the submissions. Thanks in advance!
What you have there is a bug in PyPy. Me and some friends over on discord have been able recreate the segfaults locally in both PyPy2 and PyPy3, and it has segfaulted on every machine and version of PyPy we've tested it on so far. I've never seen anything like this before.
Will definitely make a bug report once we find a minimum working example.
Here is my bug report https://foss.heptapod.net/pypy/pypy/-/issues/3297
raj1307 The bug is now reported as fixed.
Well, thanks for that :)
So,when will move the cheater and change the rating?
what is wrong in my code ??
https://mirror.codeforces.com/contest/1407/submission/92301842
#define endl '\n'
can i get input and output files for q1 and q2 because i am not able to find my logic anywhere wrong for q1 and in q2 when i checked for wa for input2 it is showing same same as answer and also check my code for q1(https://mirror.codeforces.com/contest/1407/submission/92244915) and q2(https://mirror.codeforces.com/contest/1407/submission/92258924)
In B(q2) you are sorting based on best gcd value with only the maximum element this won't work since we need gcd of all elements upto i for each value of ci.
Instead you need to keep choosing the element that gives best gcd value with gcd(all chosen elements till now). And initially choose only the maximum element.
Question D. Discrete Centrifugal Jumps With explanation.
I hope my comments will help others to underastand the solution :)
Why I was the last but still give me points?
This is caused by the way new accounts have a "special" calculation of rating. After like 5th contest that effect should be negligible.
in problem D what is the problem if I get the minimum of going to {current index + 1, the first number bigger than me, the first number lower than me, the biggest number less than me, the lowest number bigger than me} using dynamic programming???? my code
92240790 1407A - Ahahahahahahahaha I did pretty much what the question asked for. Coded the brute force approach, but I cant seem to find where I am going wrong ?
What is the idea of that code?
to calculate sum of odd positions and even positions. then checking whether oddSum — evenSum is > 0 or < 0 or == 0. then accordingly removing 1s from either the odd positions or even positions or removing nothing (== 0 case).
If you remove an element, the remaining elements switch group. Previously, all those that are odd indexed after that element become even indexed and vice versa.
Hence it is easier to just keep all the same digits (either all 1's or all 0's).
oh okay thanks!
There is another simple strategy: We can group the input in groups of 3 elements.
In such a group there is allways either at least two 1 or two 0. So we output foreach such group "11" or "00".
The case that length of input==2 must be handled separate.
thanks for nice contest :)
I really enjoyed Problem D, thanks!
Such a nice D and E. Wow.