Hi, Codeforces!
Three years later, first ideas of a contest turned into this complete set of problems, so I am glad to invite you to take part in Codeforces Round #824 (Div. 2), which will take place on Oct/02/2022 17:35 (Moscow time). The round will be rated for the participants with rating lower than 2100. Participants from the first division are also welcomed to take part out of competition.
You will be given 2 hours 15 minutes to solve 6 problems. All the problems were created and prepared by me.
I would also like to thank:
- KAN for awesome coordination!
- Aleks5d, arzhantsev64, ChthollyNotaSeniorious, DanWallgun, MagicalFlower, Gegege337, Imakf, LeoRiether, mejiamejia, okwedook, PO3OBAR_Bblnb, SSerxhs, TomiokapEace, triple__a, wabadabakalakaboo for testing the round and giving significant feedback.
- mejiamejia for his help with extra testing.
- MikeMirzayanov, geranazavr555, unreal.eugene, DK318, and KAN for maintaining Codeforces and Polygon platforms!
Scoring: $$$500-750-1250-1750-2250-3000$$$.
Note that some problems have similar scores. Your sense of the scoring distribution may differ, don't forget to read further problems if you get stuck.
I look forward to seeing you on the leaderboard. I hope you'll enjoy all 6 problems and wish you good luck!
UPD1: Editorial
UPD2:: Winners and First to solve
Div2
Place | Participant |
---|---|
1 | HugeWide |
2 | 9u46 |
3 | naaamte |
4 | seaneri |
5 | huweidong |
Div1 + Div2
Place | Participant |
---|---|
1 | maspy |
2 | orz |
3 | BurnedChicken |
4 | disorientation |
5 | Chenyu_Qiu |
First to solve
Task | Participant |
---|---|
A | bigfather |
B | Chenyu_Qiu |
C | Elaina-chan |
D | Sai_t |
E | swiftqwq |
F | tfg |
\ (•◡•) /
I can't wait to get back
I reacted with heart on telegram
wish everyone will find something interesting in this round
I hope to cross 1000 rating mark in this contest for the first time ^_^
I think, I made it :))
Mamba Mentality Round
Its time to summon the hearts <3 army. Letss go
Finally a contest on the weekend that I can do!
Hope For a Big +ve delta to everybody in the contest
That's not actually possible because rating is not calculated like this, let's suppose everybody solved all problems then its not that everybody will have +ve delta, delta is based on the people which have higher rating than you but performed less than you, then you will have a +ve delta...like sort the registered participants by rating and then see on which number you are coming if your rank in the contest is more than that then you will have +ve delta (assuming everybody who has registered participates).
A round with no tester comments! That's pretty astonishing. Edit: Now there are some.
Many users(including me) would be sad as the last round had too many FSTs and Hacks due to bad testing in problem B and C! :(
hope good pretests this time, lost too much points cus of fst
What is FST?
Failed System Testing
As a tester, this contest has a couple of nice problems, and the overall quality is much better than average!
So can you guarantee that I will go to BOI remaining purple?
[Deleted]
do you use some extension? How there is 3 extra columns in the end ?
yea, i cant find that extension, can u pls share the name
It is 'Carrot'
As a tester, I must say that the problems are really great and I highly recommend everyone to come.
Press X to Doubt
This gonna be my first contest ever, I'm so excited
Hopefully i dont get destroyed by the problems like the last contest :*).
Hoping for +141 delta
...
My first competition
Good Luck Everyone!!! Hope everyone has a fun time :)
You could find someone to teach you if you don't know how to write a problem description, and about what information shuold be emphasized.
Solution for problem D has been leaked on a discord group by a user named Instrospection. Solution is in Python
ATTENTION, please look into it coordinators and MikeMirzayanov
but how did you find that out
ahahhahahahha he was searching for it
i don't think you should comment this under the blog (where everyone can see it) in the middle of the contest :/
Strongly agree with you.
Still, he couldn't have known if it was leaked on a "discord group" if he wasn't in that group.
The problem statements were shit.
D is a good problem, but the problem statements are very bad.
I could not understand problem B at all
I spent too much time understanding the question, which is unfair to foreigners like me. Maybe my English is too poor.
I appreciate illustrations to the problem statements to make them more understandable. Without them it might've been crazy
A — 24mins, still don't know what it was about, just submitted the obvious formulae from the samples after giving up on thinking.
B — 16mins,
C — 31mins, I feel like my implementation is crap but the task itself is quite decent.
D — 24mins (just like A). Surprisingly easy. I enjoyed this kind of problem but wonder if it is too straightforward. Guess could've solved it even faster.
So to me C>A>D>B . But from the number of submissions the round seems well balanced in general except E which has a very few submissions but it is fine for most people I guess.
how do you do D? Why is it easy?
I guess as always for me I either think in the right direction or not. And here I was lucky.
First think about how to find all triplets. Notice that two cards uniquely identify the third one. So you can calculate all the triplets for n*n*k. After that it becomes a basic combinatorics
1) By two cards you can determine third to be in set
2) So if two cards determine the third, then there cannot be two sets with strictly two common cards
3) It means that any meta-set is two sets with one common card
4) This gives
O(n^2 * k)
solution (store all meta-sets by common card and some combinatorics)lol idk why so many ppl have such weird opinions on the problem set. Sure, the statements were unclear (especially for B, where it was blatantly incomplete). Regardless, I think the ideas required for the first 3 problems were what you would expect in a Div2
ok then maybe ur better than me then. I find it's super challenging to think (even if the problem is easy) after spending 90% of brain stamina to understand the statements.
I wasn't replying to you. But I can tell you for sure that the English used for A was perfect, not sure about B. It's just that A is a difficult to understand problem in itself, maybe they could have reworded it better to make it sound less mathematically rigorous?
k. Ur an english genius then.
The gap between D and E is too big.
And WHY TIMELIMIT OF D is FOUR SECOND???
Even the most brute force $$$\mathcal{O}(n^3k)$$$ can pass??? Why???
(Submission 174397296 and My hack)
Just why 4 sec??? Is there a standard solution that can`t run in 2 sec???
a very bad round for me. not worthy of the time.
wow upvotes are dropping very fast:) expected it to happen:)
Wuf. Even my python solution passed for half a second
If $$$O(n^3k)$$$ can pass then it is the fault of the weak pretests not the loose time limit.
I'm actually very surprised that brute force would pass, even with the generous 4 second time limit, since it's like, $$$10^{10}$$$ operations. My guess is that the pretests are actually not too strong, and we might see TLE hacks and/or FST on $$$O(n^3k)$$$ approaches.
I think the standard approach would take $$$O(n^2 k \log n)$$$ time (find sum of all pairs, store them in a map; then for each card, count how many instances of its additive inverse is present as a pair sum and add the count choose 2 to the answer). Mine took 623ms, so it should comfortably fit 4 seconds with slower languages or approaches with poorer constant factors (though I don't think mine was anywhere near optimized to begin with). Maybe they wanted to disallow unordered map hacks?
n^3*k passed main tests...
I think the problems is really good and I enjoy it, but the descriptions of them is so unclear that I waste lots of time. Hope the next time the words will be much clearer.
did u have to do graphs to detect cycle in C?
well, it's just one cycle so you can check indegree and outdegree but I was too lazy so I used a DSU xd
can u show me ur submission by pasting it here or somewhere else with a link? i wanna see but submission are not viewable rn
thanks
https://codeforces.net/contest/1735/submission/174413223
No graph. I used a Map to track which character corresponds to which character (obviously empty in the beginning).
Filling that map is the crux of the problem. I used a List-array of size 26 to store all connections.
String: bafdcesigh
Lists:
thanks, thats a really smart method
I used DSU with path compression. I was about to implement union by rank, when I recalled that it's only size 26, which is definitely not worth that much effort.
flakes24 it should be enough to just store a parent array or even a map to indicate which character precedes another. Then when you want to make a new mapping, you can simply check all ancestors to make sure this new successor doesn't form a cycle, unless you already have a chain of all 26 letters, so the only remaining relation is to complete the cycle. I didn't actually do this (I used DSU instead), but I think this should still pass the time limit, provided that the rest of your algorithm is efficient enough.
I thought about doing the second method (cycle method also striked but im not that comfortable with graphs yet), but it felt too implementation heavy to check 26 ancestors. But i had about 110 minutes after doing B and should have given it a try atleast. Thanks for the help tho.
btw, do u know any good resource to learn dsus in this context?
i dont know why youre getting downvoted tho
I just went to cp-algorithms during the competition for this
can you link that particular page / piece of code please
Here you go
5/10 for problem quality.
1/10 for problem description.
Solved D 30 seconds before the end of the contest b/c I had thought my sol was incorrect.
I did not like A at all. I liked B a lot. The hardest about C and D were understanding the problem statements. I am grateful the testcases were good, else I would not have understood anything.
The difficulty felt nice, except for A. I think A was too strange, took me 30min to write 1 correct line of code. Solved A, B, C and D
Upvotes on this blog is gonna drop faster than my rating
The problems is really good but the descriptions of these problems are not clear.
got a stroke reading/trying to understand problem C
E is a bit boring, because there are too many details to pay attention to.
In problem B, " You want that for each pair of pieces, their sizes differ strictly less than twice. "
Twice of what?
In problem C, " each letter in s was replaced with the one that follows in clockwise order ",
Follows what in clockwise order? should have been "replaced with one that follows it in circle in clockwise order"
Exactly ! Not specified clearly
Nice comment!
I think it is pretty clear the size of two items differ strictly less than twice means the bigger of the two is less the two times bigger than the smaller.
Idk
It definitely was not clear. My initial interpretation was that if you compare every possible pair, you would find strictly less than two instances in which the the result was that the elements were different. Of course, this would imply that all elements must be equal unless there are $$$\leq 2$$$ elements, so I was very confused at how simple this was, until I saw the test cases.
The visual explanation helped clear up my mistake, but it doesn't change the fact that the initial wording was very poor. Thankfully, a clarification was issued shortly at the start, so they at least responded properly to inquiries.
I think C is easy for people who knows graphs (dfs) and can write very hard code
I think all questions are easy for people who know how to solve it
You don't need graphs and dfs for C
Yes, but i don't say that graphs is only solution
Also come on. Stop mentioning dfs as some advanced technique that few people know
Yes, a while loop will do.
All the problems were insanely good, and I especially liked C. One of the most balanced + well prepared round I have ever participated in. Congrats to authors!
Problem F is a good problem!
I misread the shit problem statements many times. My entry experience was extremely bad.
Is there anybody else who struggled in understanding problem statements today?
I struggled a lot
Very confusing description... Had to guess the meaning based on given test cases for the first few problems :-)
Can you specify what exactly was not clear?
Perhaps "very confusing" is a bit over, but I think I do need to carefully look over every word in the description to understand them, while in previous contests just skimming over is enough. For example, "For this reason, all 26 lowercase English letters were arranged in a circle in some order, afterwards, each letter in s was replaced with the one that follows in clockwise order, in that way the string t was obtained." It seems unclear to me what each character in s is replaced with, and I had to go over the TCs to make sure what I am thinking is correct.
How to solve D?
Ok, this was the first time I solved D, and to do so I broke this problem into different parts, so the first significant observation was no 2 sets can have 2 same cards, as it will force the third card to be same and hence 2 sets to be same. So let's say card 1 was in 6 sets then I can combine any 2 sets and that will be a meta-set, so the total meta-set would be 6C2 (choose any 2 sets among all possible), so, if I am able to find in how many sets each card is in then I can sum all their results (cnt[i]C2). To find a set, for each pair of cards I found out which was the required card so that they form a set (this card will always be unique) and checked if that card existed in our n cards, to do so in log(n) I stored each card in the map. so total time complexity was O(n*n*k*log(n)).
Make it unrated
Why? That's all legal. Statements hard to understand but you can understand
This round must be unrated because we can't understand the problems. So without understanding we can't solve.
some people are not good in english so you better use simple words/sentences.
"their sizes differ strictly less than twice." this is shit.
1.Read carefully 2.Watch at examples and notes 3.Use translator
I think, your problem isn't "understanding problem"
How much for a good problem statement, please? ,
why engish in this round so hard to understand qnq
Is there anyone like me? When I'm confused about a problem statement, my brain is fried and can't think anymore for the rest of the contest.
I was super confused about A and D problem statements.
I spend about 20 minutes in understanding problem A and decided to leave the contest.
I spend around 25 min in finding a approach with wrong submission , It is more logical than B
I quickly found a solution for E, but unfortunately, because i was stuck on C for a long time because of implementation issue, i had no time to implement E. Solved A,B,C,D
Solution for D:
Firstly,let's find all "sets":
Enumerate each pair $$$(card[i],card[j])$$$,we can calculate a unique $$$card[k]$$$ according to $$$card[i],card[j]$$$.
Next, we only need to check whether $$$card[k]$$$ is in the given cards.
Time complexity:$$$O(n^2k)$$$.
Next, we notice that the intersection of two "sets" has at most one card.
$$$Proof$$$:assume the intersection of two "sets" has 2 cards $$$card[i],card[j]$$$,we can calculate a unique $$$card[k]$$$ according to $$$card[i],card[j]$$$,which leads to contradiction.
For each $$$card[i]$$$,suppose it exists in $$$k[i]$$$ sets,if $$$k[i] \geq 2$$$,we can select two from the $$$k[i]$$$ "sets" to form a "meta-set".
It can also be proved that all selected "meat-sets" are distinct.
So the answer is $$$\Sigma {C^{k[i]}_{2}}$$$.
D and E are amazing!
D ... All CPer who have played SET must think "From $$$2$$$ cards I can identify the last card" at least once, I guess.
E ... We must use matching to solve this? Nope.
rainboy and others tried doing that and most got TLE.
good contest!!!
6
dag wall how eye knee
Problem description left the chat.
i spent more time understanding problem statements than actually solving them.
CF rounds helping us practice reading comprehension as well. nice.
yes lol
"their sizes differ strictly less than twice." I bet it'll be fun to solve the "once" version of it. Twice fun in fact.
It was a weird way to write the statement ;/
I solved A by test case №3 i just divided 1033/3 and found genius formula.
Problem D
English version: "A feature for three cards is called good if it is the same for these cards or pairwise distinct."
machine translation of Russian version: "For a trio of cards, a characteristic is good if it is the same for all three cards, or all three are different in pairs"
Sad that I prefer the machine translation...
Can anyone please explain problem C in a clearer way?
in order to get the lexicographically smallest string you should go from left to right and try to map every character by the alphabetical order from a to z,consider it as graph where there is a directed edge from a character to the character it is mapped with, here you should take care of 3 cases
1 — you can't map a character to itself (loop edge)
2 — you can't make a cycle of length less than 26
3 — you can't map a character to an already mapped one
take a look at my code , i hope i made it clear.
where is your code?
174420886
Many many thanks for explaining the solution approach, but I was more into problem statement, what actually the problem said?
simply you initially have a string s , to obtain the string t you make your own alphabetical order of the 26 letters such that each letter in string s is replaced by the letter the goes next to it in the alphabetical order you just made
for example if your s is aqerk and your 26-string order is something like au..qw..er..rz..ko , then your t-string is uwrzo
now you have string t , you should output the lexicographically smallest string s which could lead to string t by some mapping order
ReadingForces
Very intresting!I tried my best and I think I will get a good result.I really love these problems.
I really enjoyed today's contest. Although some of the problem descriptions werent the best, problem A B and C were very interesting and the pretests were very strong. keep it up!
Howard Hamlin of HHM, I sincerely agree to your opinion.
Problem description is like: Go A to B then go C then back to B, again back to A then go C finally print "Helo World".
Had a contests filled weekend and I had a great time
The questions were really good! Thanks for good questions :)
My only possible critism is that this round was more about finding ideas....
But I really enjoyed it!
Anyway, a good contest!
Agree with you :)
can someone please help me, where am I going wrong this is solution for B
I think you need Math.ceil(1.0*arr[i]/div)-1 instead of Math.ceil(1.0*arr[i]/div) as dividing a number in n pieces will need n-1 operations
Note: ans+=(arr[i]+div-1)/div-1; That is math
In problem D, I used unordered map to hash from vector of int to int and it took over 1 second to run which is longer than most submissions. Anyone know why?
hash function could be slow, there could be hash collision in your hash function, or else there is somewhere else that adds/multiplies to the time complexity.
Is there any better data structure to store the value for each card? Because editorial also suggests us to use map/hashmap.
I think map/hashmap is good enough for the question, but generally I don't recommend you using unordered_map on codeforces, as it could be vulnerable to hacks by deliberately causing hash collisions.
In the case of problem D, I think it is possible to hash the set without hash collisions using 3**k and long long int; If you used this as an hash value, I think map/hashmap is going to be near to best you can use.
Yeah, I just tried your suggestion and it still took quite long so the problem might be my implementation. Anyway, thanks a lot for detailed explanation.
I see that there are several testers. Do they only verify the accuracy of the judge data or do they proofread the problem descriptions as well?
Can Any Body explain the Solution of Problem B
174391163 if you see my code.I think you can understand this problem.
It is no good to divide further the smallest number, as it will always result in more operations caused by having to divide up other numbers further. And therefore, we can transform the question to: given n numbers, make every numbers that are not the smallest number between the range of smallest number/2+1 ~ smallest number*2-1. Dividing each number so that all numbers are between the range will take ceil(number/(smallest number*2-1))-1 operations: and so the answer is the sum of it for all numbers.
dhyang24 why you have taken ceil(number/((smallest number*2)-1))-1 rather than ceil(number/(smallest number*2))-1 this
The question states that the biggest number should be strictly smaller than smallest number*2; the maximum number after the division must be (smallest number*2-1)
It is guaranteed that if you divide a number in ceil(number/(smallest number*-1))-1 parts, when evenly distribued, it is in the range of smallest number/2+1 ~ smallest number*2 -1
And can you tell why have take -1 after calculating ceil value
dividing a number into n parts will take (n-1) operations, as each operation increases the total number of parts by 1, and the initial number of parts is 1.
Ok I got it thanks for giving time to my Queries dhyang24 And Congrats for becoming Candidate Master
I’m sorry that the English statements are confusing.
I tried to make them plane, but it was hard for some sentences.
We discussed the places you were confused by and these are the best formulation we eventually came to.
I would really like to see your suggestions for replacing them. I still can’t choose good options. I hope that next time I’ll be more careful and precise.
I hope you enjoyed the problem ideas after you got through the statements.
Anyway, don’t forget to check the editorial and feel free to ask me if there is something unclear there too.
Problems have pretty bad wording, otherwise it is fine I think
C, it correct when I tested but codef say... 174424830
I don't understand your approach entirely (it would help if you commented what the different arrays actually meant), but it seems like you're missing the check for when all 26 letters are linked, in which case you would need to link the endpoints to form a cycle.
Instead, I think your approach would eventually try to extend beyond the 26 letters and/or try to access an array element that was not initialized, which can lead to different results. As such, even if you saw the correct answer on your own machine, there may be undefined behavior, which can lead to different results in other machines.
I need upvote anyone can help TT.
Ratings updated preliminarily. We will remove cheaters and update the ratings again soon!
speedforces
not really, at least problems up to C were definitely not the hardest problems (in the corresponding position) I've ever seen. I even thought D might have been worth a try. (though I did lack the ideas for it)
Problem F is very nice, thank you!
In question C: why can't
because you must always get a big loop with length 26. But in your example you have loops: a->b->a, d->c->d and so on
Oh yes....got it. Thanks
You're welcome)
There is Codeforces Official Channel in Telegram with round announcements. For some reason, all posts get an overwhelming amount of thumbs down. Can we turn the situation around and let hearts win?
209 hearts and 139 thumbs down at first message, 134 hearts and 137 thumbs down at second, hearts are winningI like this Score Distribution : 500 — 750 — 1250 so much
Had lot of learning and fun. Thank you
I think the problem D should add a tag named Reading Comprehension.
I don't quite understand why there are many difficult questions to read recently, such as the D question, which is difficult to understand, but I can quickly pass after understanding
D and E are very nice problems! (especially D in my opinion)
can't find my rating; I can still see the score and rank, but not rating, I remember seeing a notification saying that my rating has updated post this contest. Was the contest made unrated or is this something that only I am facing?
My solution to A was reported similar to someone else. Now, this is because we happened to use the same code template, which is available online, and the code for A was pretty short and simple. This is a mere coincidence. Why would I plagiarize problem A. Please revert back my rating changes, I have given the contest honestly