Привет! В 02.05.2022 17:35 (Московское время) начнётся Codeforces Round 786 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6 или 7 задач (или 8), которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.
Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Вам будет предложено 6 или 7 (или 8) задач и 2 часа на их решение.
Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.
Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:
- принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
- не иметь в рейтинге точку 1900 или выше.
Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.
Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев, Александр fcspartakm Фролов, Иван BledDest Андросов и Михаил awoo Пикляев. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.
Также спасибо ashmelev, Vladosiya, mesanu и I.AM.THE.WILL за тестирование раунда и полезный фидбек по задачам!
Удачи!
UPD: Обратите внимание, что задачи раунда частично пересекаются с задачами Внутривузовской олимпиады Саратовского ГУ по программированию. Если вы участвовали в олимпиаде, то воздержитесь от участия в раунде.
UPD2: Разбор опубликован!
Good luck everyone!
omg vovuh div3s are back!!! :D
Yes, I hope no smurfs and good luck to everyone!
Best way to celebrate my birthday!! Vovuh's Div3s are lit!
I have been participating in Div3 for quite a long but this contest never went unrated for me. I wish it doesn't happen again after this contest.BTW, Best of luck everyone.
Best Wishes everyone for the contest and Happy Eid to all of you.
vovuh, welcome back
I have a question why some of the announcements don't give us exact numbers of problems?
I think because they don't have a final problemset yet, maybe because they have 8 or more problems made but they are not sure which problem to put on 1-2 places, and they will decide later
hopefully i get specialist yoooo
Eid Mubarak today
Did someone notice, its Codeforces Round #786(the holy number) on the eve of Eid-al-Fitr!!! Such coincidence Much wow!
vovuh welcome back in div 3s
welcome back in div 3s, vovuh
or 9
Eyeing specialist from a distance 0_0
Hope I will be specialist after this div3 contest!!!
I want be specialist after this contest.
vovuh welcome back
please make the time of the contest 2 : 15
Long time these authors have not done div 3. All good solutions!
I think this will be a div 3 round.
Very Bad contest
I am Very Bad, contest.*
Skill issue,copium.
Marinush
Masterpiece. I laughed sooo hard when I saw this :D
Why there is not any example or description note for test cases in problem F... can't really understand the test cases :(
Spent 30 minutes to understand F :(
I spend 30 minutes to debug F)))
I has closed div 3. Very good problems! Upd: hacked E :(
I think D is the hardest problem :))
what was your approach? I tried like this but failed — the pairwise mins in array A must have an increasing order. for odd n the pairing excludes the first element, but it has a constraint to be the smallest integer.
sort each pair of (N, N — 1), (N — 2, N — 3).... and check if you can get sorted array. your solution does not work for 2 4 3 5.
Orz
G is a simple but educational problem. Hope there will be more problems like this in the following div2/3 contests.
Can you explain it please?I think it's the longest path in the graph after deleting some edges but there are some cases that I choose edges that I shouldn't
It's a simple dp problem where you first topsort the vertices, and then for each vertex $$$u$$$ with in-degree greater than 1, you iterate over the parent nodes $$$v$$$ ($$$v \rightarrow u$$$), and if the parent node has out-degree greater than 1, you update the dp value as $$$dp_u = dp_v + 1$$$.
Since the graph is a DAG, you can use memoized search instead of topsort
E — Breaking the Wall, Wrong answer on test 32. What was that?
I got wa on test case 50
There are a number of situations you must think of.
WA on test 20 three times and 32 twice.
for problem F, Test 32 had a situation where the entire grid was filled with '*' for sure.
Try this, it helped me pass #32. Correct answer is 11.
can u unfreeze the standings + let us submit
Interesting tasks and good round! Thanks :)
I did'n noticed that problem G statement:'a valid directed acyclic graph', I tried tarjan to shrink strongly connected components into points (poor english).Although it was unnecessary, I'm just wondering if this algorithm would be correct without such a condition.I would be grateful if someone could help me.
Why results are frozen?
I can't submit((
You can register for practice and still submit.
How it should work? It just reloads the page
I spent 40 minutes on D and got TLE because I'm using native linked lists, there is no way you wanted me to implement an optimized liked list for this right?
Nope, note that you can only change the relative order between two elements after sorting ($$$a_{n} \leftrightarrow a_{n - 1}, a_{n - 2} \leftrightarrow a_{n - 3}, ...$$$)
you don't really need to do the operation.
can you explain how to calculate it then please
do some simulation and you will find you only can pairwisely revert elements from the right side.
Let the $$$n$$$ integers be $$$a_0, a_1, \ldots, a_{n - 1}$$$. We are taking out from the rightmost integer, and putting it in the middle. Then, we will take out from the middle and placing it to the right of the array. This problem then just translates to checking whether the original array can be in a non-decreasing order only by arranging the paired integers in each of the following partitions: $$$(a_{n - 1}, a_{n - 2}), (a_{n - 3}, a_{n - 4}), \ldots$$$. Iterating from right to left, for $$$n - 1 \ge i \ge 3 - (n $$$ % $$$2)$$$, if $$$\min(a_i, a_{i - 1}) \ge \max(a_{i - 2}, a_{i - 3})$$$, we continue until all of the partitions are checked. Otherwise the answer would be "NO" and we break the loop. If $$$n$$$ is odd, for the last $$$2$$$-integer partition, we check if $$$\min(a_2, a_1) < a_0$$$. There are trivial cases which are if $$$n = 1, 2$$$, and it is easy to check that the answer for these cases is always "YES".
vovuh rocks!!
anyone explain F pls
remember the total number N of current icons on the screen, and the number of icons in the first N cells. The result is the difference between them. Use fenwick tree to find out the second value.
Actually there is no need for a Fenwick tree. You can simply iterate through the columns for each query and sum the amount of operations needed
Looks like with this time complexity it will work only for c++
You can consider unraveling the matrix resulting in a vector (i.e. taking the first column, then second, then third, and stick them to make a new vector). Then, the apps need to be in a prefix of this vector. when adding a image, you extend the prefix, otherwise you need to shrink the prefix (where you need to move the icons). Then, to find how many images you need to move is to calculate the number of images you have in the prefix you currently are in. If this number is X, and you have Y images on the desktop, then $$$Y - X$$$ is the answer. To calculate X, you can do some if's when erasing/inserting images (to see if they spawn/despawn directly from your prefix)
You had to count gaps in the icon arrangement using segment/fenwick trees.
Video Solutions: A-F
No need of segment tree or fenwick tree it can be done without any extra log factor just have a two variables currow curcol which will denote the position for last icon after rearrangement. And whenever a new * is added somewhere just change the curpos to next postion by curcol+=(currow+1)/n currow=(currow+1)%n; and calculate total stars and number of stars inside the consecutive region. Submission- https://codeforces.net/contest/1674/submission/155735790
Aight, guys. This comment may seem a bit toxic or something, but I still want to express how do I feel about this situation. Firstly, I want to say that the problem F is mine (I'm an author of the idea and I prepared this problem).
I get when people are confused about palindrome bracket sequence (as it was in some recent Educational Round), this thing can be really confusing when you see it. But I can't get how people are not familiar with the order of icons appearance on the desktop. Like, if you code from your phone or from fedora or some other OS without GUI, the desktop itself for you can be really confusing, but I don't think there are a lot of such people among Div.3 participants. So, I can't believe nobody saw that when you install some application and mark the field ''add the icon to the desktop'', this icon appears in the first column that is not full, and then in the first position from the top inside this column. Also, when you sort your icons, they're rearranging exactly as in this problem. I thought I created a very life-based problem and people will understand it easily, but I was wrong.
Moreover, the statement wasn't perfect, but was clear enough. There was the following sentence in the second paragraph: ''In other words, some amount of first columns will be filled with icons and, possibly, some amount of first cells of the next (after the last full column) column will be also filled with icons''. I agree that I could add some pictures or maybe highlight some words in the second paragraph, but I thought this is very-very life-based thing that anyone will understand without problems.
At last, I agree that I'm not completely right in this situation, because our task is to make statements as clear as possible for anyone. But, as I said before, this is just my personal opinion, so you can discuss it with me here or maybe just downvote this comment if you disagree.
The statement is a bit hard to understand, but anyway it's still OK to me.
Hey, thanks for the problem, and for the years of service!
I think the statement was okay, but when reading it for the first time, I felt like an image with the statement would be perfect. Or maybe, explanation of one test case.
As a tester, I agree with vovuh. I also thought everyone encountered desktop arranging at least once and would understand the problem perfectly. To me, it seems like a very nice life-based problem so I didn't suggest any changes to the statement. Will definitely keep such things in mind from now on though.
For problem F, why did the question allow a time limit of 3 seconds? It'd be reasonable to make the participants to use a time limit of 1 second instead.
Yeah, that's probably true. I was just scared that some python/java/(any other non-CP language) users couldn't solve this problem because there is too many IO. But I was completely wrong, so there are also some $$$O((n+m)q)$$$ solutions in C++, and this is a bit disappointing. I also discussed this with Ivan, and we decided that 3 seconds is okay, but turned out it wasn't.
"But I can't get how people are not familiar with the order of icons appearance on the desktop."
On mac, by default it is right to left:
Problem E's pretests are so weak!!!!!!! I have already hacked myself!!!!
Educational rounds and div3s are meant to have weak pretest. Why do you think there is a 12 hour hacking period?
But it is the responsibility of questions setters to have strong pretests that contains most situation of the problem,rather than called the competitors to successfully hack more than one thousand accepted answer.
Dear contestant...
Please don't worry if you had to hack yourself in order to see if your solution is good. In a programming competition, the tests used can be useless, you should have assured your code works. Sorry if this does not fit in your view.
Author of xem sdod
Imposter?
Dear non-contestant,
Please don't worry if someone else is a fan of EGOI and swapped two letters from your name. In a programming community thoughts as such are completly irrelevant. Apologies if this does not fit your view.
So, can we please get back to programming ?
Thank you vovuh and the team for organizing this Div 3 contest. I love the questions and how they were being framed.
Amazed to see some red+ coders getting hacked on E. What is the hack case ?
try 5 1000 7
What is the answer ?
6
That means I am also going to get hacked. How 6 is the answer?
5 in the middle, 1 on 7.
Shoot once in the middle , twice left and thrice right. Nice! Thank you
It can be proven that in those cases, you can reduce them to shoot 0 or 1 in the middle
9 hacks with 100 1
thank you AHMADUL for solving A!!!
in D I thought that the operation from b to c was the same as from a to b. F :(
I spent about 30 minutes thinking of a solution for this problem before I realize It was not the real problem
Testing data for problem E is far too weak.
We can hack a lot of solutions using this data.
idea for d? and whats on pretest 32 in e?
so many hacks to E...I have rised from 600+ to 400+.
;-; Got WA on C just because I wrote
(1ll<<a.size())
aspow(2,a.length())
Can someone explain to me, what's the point of the removing condition in G? Doesn't it allow us to remove any edge?
The condition is that, after removing any number of edges, the final graph MUST have in-degree and out-degree of EVERY vertex to be strictly less than the original graph (except if the in/out degree was 0 for any vertex in original graph).
For example, if there is a graph 1->2->3->4, then we can't just remove 1->2, because in the resulting graph (2->3->4), the in-degree and out-degree of 3 are the same as that in the original graph.
thanks, I got it now
thanx for good and strong E test's!
any
hint
for E?I'm trying to explain my solution while my solution is hacked...so I deleted all my notes...
One minute I was hacking my junior, the next I was being hacked by myself...
I didn't noticed acyclic graph in G...
Wow tons of hacks on E. Accept number decreases in every second!
I forgot a corner case (1 10000 3), the answer is 2(shoot middle, then right). Weak sample and tests.
Upd: till now, about a half solutions hacked!
E's pretests are a joke
These hacks are crazy, I have gone from 170th to 89th in 45 minutes after the contest. Maybe I will be next...
Cursed spoiler:
now try to close it again
What does E's pretest mean...I wrote this chmin(ans, (mx + mx + 1) / 2); Then it's got AC????? Of course it's hacked...
I am a simple man, I solved 5, my rank was initially around 1800, then everyone started getting hacked and my rank became around 1200 :) , and then ( you guessed it right ) I myself got hacked! now my rank is 2200+
Please CF don't troll me XD
Problem E: My solution
Whats wrong with this?
Test: 10 3 10 9 8 7 2 5 10 10 10 Answer is 3, but you have 2(
2000 participants: "I solved E!" Joury: "No You didn't)"
There are more than 50 pages of successful hacking to E. Never imagined to this...
The pretests are weak — I solved E, then got hacked. I forgot about the case a[i] > a[i + 1] * 2(and vice versa) (then it's not (a[i] + a[i + 1] + 2) / 3 but (a[i] + 1) / 2)). Such a simple one, but pretests didn't cover that case..
There are no pretests in div.3, div.4 or educational rounds. It's full feedback meaning submissions are judged on all tests. Although, the tests on E were weak no doubt. The solves went from ~3000 to ~550 after system testing was over.
Thank you, didn`t know that
interesting in hacking problem E the real game
Enjoyed the few minutes when I thought I solved E
I have been hacked :(
skill issue
Too weak E pretests!!
proof by AC isn't working with problem E
This round is amazing ,Because some of my friends get higher ranking than one hour ago。
If everyone is hacked, it means everyone is not hacked.
I might be making a rude comment but the number of hacks makes me wonder that is the Jury's solution completely correct? Is it not possible for some really correct solutions to get hacked just because the jury's solution happens to be not perfect.
Just a thought.
My dear friend, you are absolutely wrong jury always have a proof to defend their solutions
The hacks are tested against jury's solution, that means the jury solution gives different output from the hacked solutions. Which means it's correct.
Moreover, there is not just ONE jury solution, usually there are at least 5 to 10 different valid solutions (written in different languages)
Oh alright. I didn't know about this.
"You should always prove your solutions before submitting" — Tourist
And then get a WA coz your proof was wrong
Alright, for those that had wrong answer on pretest 32 in problem E like me, maybe this one will help you:
2
3 6
Answer is 3. I had 4 because I was trying to reduce by 3 both numbers while possible (applying two operations, subtracting 1 2 and 2 1) but this is not optimal, as you can just shoot number 6 three times.
Is it May's fool? :')
Eternal peace. :(
Problem E: failing just like the question name : Breaking the Wall (of pretests)
If you prefer command line, checkout CF Doctor for more flexibility and faster feedback.
If you are/were getting a WA/RE verdict on problems from this contest, you can get the smallest possible counter example for your submission on cfstress.com. To do that, click on the relevant problem's link below, add your submission ID, and edit the table (or edit compressed parameters) to increase/decrease the constraints.
If you are not able to find a counter example even after changing the parameters, reply to this thread (only till the next 7 days), with links to your submission and ticket(s).
A B C D E-Hacked
I have just refreshed the page and 620 accepted solutions for E became 570(during 2min). I am sure till tomorrow there will not be correct solutions
What does "the prefix of the next column" in F means? Does it mean that I need to put all remaining icons to the upper side?
Yes
Yes. Effectively it means that if you took all the icons out, you would fill the columns greedily left to right, and within each column greedily top to bottom.
Correct configuration:
Incorrect configuration:
Can anyone help me know why i am not included in common standing. I do not have a rating of 1900 ever. Am I not trusted participant ?
you are in common standing see here https://codeforces.net/contest/1674/standings/participant/132264249#p132264249
do successful hacks give extra points for this round?
nope!
really? Damn! I hacked 10 submissions. I guess it was a waste of my time... So why do problem setters provide 12 hours of hacking phase for participants? Do they want us to make strong pretests for them?
It was a waste of your time if you didn't learn anything from it. Otherwise it wasn't.
Div 3 (and 4) rounds are run according to Educational Round rules. The purpose of the 12 hour hacking phase is to encourage the studying of others' code and learning how to stress test, debug, and spot holes in algorithms. Often the tests deliberately leave out certain cases to make hacks more likely (though rarely as extreme as problem E today).
If you only did it for points then yes I suppose you did waste your time; otherwise you did exactly what the round is designed for.
I meant to say that doing 10 hacks was a waste of my time since nearly all of them failed on same test case, and obviously I learned why those submissions failed
it's not a waste of time if you hacked people with better ranking than yours
Anyways, You don't get points for hacking in Div 3
hacks ;-;
E stands for emotional damage :sadge:
Was hacked in E because of the case for (i,i+1) we have equations
2*k1+k2>=a[i] 2*k2+k1>=a[i+1]
when k1<0 or k2<0 my solution was not working. This case should be in pretests!
E: WA on pretest 14 and 32 -> could not even enjoy the temporary happiness
and if you had no participation and zero rating, then the rating will not rise?
Could someone please try and hack 155731727
I want to see if I have written the correct solution. Thanks,
all system tests (with hacks) are available now. if you pass it then solution is correct
Your solution is completely correct.
Thanks for the feedback
I have a question when this contest is rated.
I have this question, 2!
Here are video Solutions to all problems in case people are interested.
Why I haven't get any rating after participating in the contest and solving 3 questions there?
Can you explain me why I haven't got any rating after participating in the contest and solving 3 problems there?
Ratings are not updated yet, they will be soon.
This F problem is not as difficult as F problem. Original two-dimensional problem can be very very easy converted to one-dimensional.
yeah, but it isn't as hard as f even without converting imo
Difficult reading questions.
Hello MikeMirzayanov,BledDest,vovuh,adedalic.System
I find out some plagiarism activity in Codeforces Round 786 (Div. 3).
Please check out submissions of problem 1674B - Dictionary,submissions are 155621247 and 155678427 They both have same function with same variable but just comment down it and wrote it again with some variable change. Please look out at it.
Proofs given below and also you can check submissions...