Hi Codeforces!
Keshi, alireza_kaviani and I are delighted to invite you to participate in Codeforces Round 800 (Div. 1) and Codeforces Round 800 (Div. 2).
- Start time: Jun/16/2022 17:35 (Moscow time)
- Duration: $$$120$$$ minutes
- Number of Tasks: $$$6$$$ for both divisions
- Rated range: ($$$-\infty$$$,$$$1899$$$] for Div2, [$$$1900$$$, $$$\infty$$$) for Div1
We are honored to have set the 800th Codeforces round. We wish this wonderful platform all the best along with many other exciting rounds.
Huge thanks to the following people:
antontrygubO_o for his breath-taking coordination.
Our testers Um_nik, errorgorn, Koosha_Mv, irkstepanov, ymmparsa, sohsoh, fatemetmhr, Dorost, nor, pooya-shams, Arnch, Kahou and mosaev for testing the round and providing invaluable feedback.
radiohead because we got inspiration from them while coming up with task names.
MikeMirzayanov for the amazing platforms Codeforces and Polygon!
Last but not least, to all the participants of this round!
Thanks to NEAR for supporting this round, details can be found in this post.
We have worked hard to keep the statements clean and the pretests strong!
Please read all of the problems and their notes, enjoy your time and solve as many as you can! Good luck have fun to everyone!
The scoring distributions will be announced later.
UPD: Here are the scoring distributions:
Div. 1: 750 1000 1500 2250 2500 3000
Div. 2: 500 1000 1500 1750 2250 3000
UPD: Editorial is out!
Great contest! you will enjoy it.
lol .. He said Huge thanks to testers for providing
invaluable
feedback.If you dont believe me scroll and check.
invaluable != not valuable
invaluable is actually of stronger positive meaning than valuable, its easier when u understand it as "unable to be valued as it is too precious to be"
i did'nt know ThankYou
don't use past tense with did not, i also did earlier, SAY i did'nt know
ok sir.
Thank me later :)
i think i dont need to.
You do, kindly
Orz
Orz
Orz
Orz
[Deleted]
ratio
Orz
Orz
orz
oml how far is this going
Can't go anymore :(
The debates reached maximal permitted depth, so your message and the message you are replying will be displayed on the same level.
Yet another great Iranian round :) orz
Hope everyone can be red in this contest (of course include me).
btw congrats to alireza_kaviani for qualifying in Iran's IOI 2022 team
Manchester is RED , alireza_kaviani :) orz
Codeforces orz
MikeMirzayanov orz
Polygon orz
Orz
Orz
Orz
Orz
ORZ
orz
Orz
Edited: Sorry no orz no orz !
Orz
Orz
Orz
Noo orz!
Paranoid creepy tasks?
Don't worry, no surprises.
Don't worry, there will be no more than $$$10^9+7$$$ suprises.
You don't belong here
You don't belong there
As a tester, problems are great and statements are short.
I encourage you to participate in this round!
You will definitely enjoy this round!
Haha certainly....but sometimes short ones are the real fire ones...looking forward for this round....
Where is translation into russian?
Another div1 with trygub support? It will be fine.
Hope all the best for everyone
Finally, my first Div 1 contest. Yayyyy. Every time I used to fall back to expert just before Div 1 contests.
Have seen you somewhere ... anyways best of luck...
Good luck for everyone!!!
good luck for everyone
good luck man!
ok thx
Um_nik orz
Good luck !?
Naah,it won't help :(
800th round! A great number
My first time participating in Div. 1, I am so nervous.
how you became expert in your first contest itself??
I thought the base score was 1,500, and I got +167 in my first contest.
Wow, great!! 800 contests, its huge!! Thank you Codeforces❤️
I know I won't be able to solve any one of em, still gonna participate..
That's the spirit! Wish you the most of luck! <3
Yes you are noob
No stool, Sherlock!
And you are an LGM?
GAP
Hope I don't go back to being a pupil :/
When someone says orz as a comment
orz
tell newbie what is orz
https://letmegooglethat.com/?q=what%27s+orz%3F
is it contest?
No, it's a twin contest.
no, it is rated.
I guarantee you will enjoy the contest.
I hope I don't lose points in this game.
I thought so too.
I thought so too too.
I hope so too.
No offence but why does authors tend to hide the score distribution and reveal it just before the contest starts?
is there a hidden strategy out there?(⊙⊙)(☉_☉)(⊙⊙)
Lmao, what does +inf & -inf rating mean !!
infinity, quite literally. If you did not know, negative ratings exist and they are not rated in most rounds (most rounds' rated range begin from 0)
[1900, tourist] for Div1* :v
It should be [1900, tourist].
That time tourist didn't registered.. now registered.
Orz to people that have actually seen his handle fully red
Good luck for everyone!!!
Why only two div2 testers?
And his name is Jauun Cenaaa...
Why so many orz comments? Could someone explain, please?
A Hieroglyph.
RIP Score distributions.
When will be the score distribution update? It's just 1 hour 12 minute remaining.
My first contest!!
Not a Doctor Still doing a lot of operations.
Won't say bad round. I liked the Problems though.
I think that this contest isn't good. I can't understand the problems well.
Why so many downvotes !? It's my personal opinion !
Because people didn't like your opinion. I mean that is how this system works. If people don't like your opinion they downvote you. if they like it then they upvote you.
If this was a Div2 I am a refrigerator. tf.
I don't mind difficult problems but a,b,c are very observation based and took me a lot of time, hence we don't get enough time for interesting problems like D
I dont like this round (my opinion)
I respect the work of autors. Its very cool to do problems for codeforces round. I dont like this types problem. Thats what I meant.
I guess I am just dumb.
Round #800 CLASSIC GREEDY ONE !!!!!!
I didn't expect adhoc tasks :(
I liked problem C. Sample cases were very useful for solving.
I hated it for that reason, but problem was very good . They should'n have provided the 5th sample it was easy to guess then.
The comment is hidden because of too negative feedback, click here to view it
That's kinda funny tbf
How to solve Div 1C?
Reverse the graph and then do something very similar to dijstrak starting from n-1. Notice that at some node, you have a bunch of nodes you can go to and if you know their distances, you can kill some in descending order(so like their effective distance is +0 +1, +2 +3....) and find the optimum of that. Thus, what you can do is to store the current estimates incoming (after reversing) for each node and pick the best (similar to dijstrak) after adding some weights. Then, we process the nodes by current estimate similar to dijstrak. But this may potentially force you to reupdate the whole set everytime you process a node. But, you realise that you only add numbers greater than numbers you add before (since you process nodes in ascending estimates). So, you can just store the best estimate.
Essentially its just do dijstrak with the following modification:
dist[v] = min(dist[v], dist[u] + indeg[v]) indeg[v]--
I still cant really prove why this would be entirely correct though.
For problem D: if the sequence is decinc, there are only at most $$$3$$$ representations of it, that are of interest. For maximum increasing subsequence, you must use all elements except maybe one and if you don't use an element in the increasing sequence, it's always either first or last element.
Note that if the sequence is decinc, then so is all of its subsequences, hence you could kind of make a binary search for each $$$L$$$ on the largest $$$R$$$ such that $$$[L; R)$$$ is decinc.
But my solution failed pretests because it uses binary lifting and needs $$$O(n \log n)$$$ memory. I'm pissed off it doesn't pass.
Now that I think of it, you can probably also do it in $$$O(n)$$$ with two pointers?
I've seen a version of Div1D with answering for whole sequence in a few Polish competitions, so the key observation (that we can build the answer greedily) was known to me (I'm not saying that the rest is correct, last rounds weren't generous for me).
I can write a bit more: assume that we've split the prefix into two sequences (decreasing and increasing) and the next two elements are $$$x$$$ and $$$y$$$, where $$$x$$$ can be appended both to increasing and to decreasing sequence. It turns out, that if $$$x<y$$$, it's optimal to append $$$x$$$ to increasing one. If $$$x>y$$$, it's optimal to append $$$x$$$ to decreasing one.
Approach for Div2C??
Beginning from last non-zero element, iterating backwards, keep adding arr[i], sum must never be >=0, except at Oth element. That was the opeartion about.
i was iterating from backwards and decreasing the current element say a[j](initial array) by k such that it gets equal to m[j](given array) and adding k-1 to a[j-1] lastly i check that array is equal or not alongwith my pointer is on the first element or not this approach is giving wrong answer
note that last non-zero element can't be negative, but your approach may give Yes.
160850010. I did the same thing. This might help
Extremely thankful!
let j = position of last non-zero number (1-indexed)
There must be no prefix sum of length i(0<i<j) with sum <= 0
A[j] must be negative and total sum of array A = 0
Div2B was hard -_-
maybe you are just paranoid
I'll suffer from PTSD from now on for string problems :(
Post Traumatic String Disorder
what's the solution for div1A? I have no idea why I got AC
Hey, Can I ask you, As a div 1 participant how was Div1B?
actually pretty simple problem on dp on trees
Can you please explain your solution, or suggest some similar dp on trees problems.
I don't know if i am eligible to explain something to CM, but this is how I solved.
PS: We also need to check if at some point right[i] becomes zero then all the array elements from that index must be zero, since we dont move towards right anymore.
oh, I understood, thanks! not bad problem though
tox1c_kid got trolled
Do you have a small test case that fails this simple and wrong solution for 1E?
I also had the same idea, but here is the problem: It might be better to take the right maximum and then the left maximum afterwards.
test case:
5
4 3 5 1 2
The min for 4, 3, 1, 2 is clearly 1. But the min for the 5 would be 3. However, we can take right maximum and then left: 5 -> 2 -> 0. So answer is actually 1+1+2+1+1 = 6 instead of 7.
1693C - Keshi in Search of AmShZ is the problem of the year.
Disagree, C was standard imo, for example 102341H - Hypno is very similar, but a bit harder.
D, E and F were rather nice, a bit of AtCoderForces spirit, but still way better than most AGCs.
My bad, I had never seen anything similar to C.
Nope, not your bad, it's just your opinion versus mine. The fact that for you it was good and interesting can only be a plus for the problem. :P
Character Development.
wow, it's an honor.
Problems were interesting.
So hard..... I can not solve (Div 1. C)1693C - Keshi in Search of AmShZ, I thought topological sorting + DP may work, but what if the graph has a loop and is not a DAG?`
`
you run a djikstra-like algorithm on the reversed graph. In each iteration, my solution has an invariant that the nodes that have been popped from the set have the smallest values of $$$dp[u]$$$, where $$$dp[u]$$$ is the minimal cost required if one starts from node $$$u$$$ and goes to node $$$n$$$. We remove edges only when we are at the node from which the edge emanates (goes out). Then you can see how a djikstra-like algorithm always maintains this invariant, and hence answer is $$$dp[1]$$$.
details: 160892338
I appreciate it, I think I do not understand the idea of djikstra totally, it is time to take my DS book up again.
Sadly, I may get a down rank.
D1C is amazing and suitable for commemorable 800th round, thanks!
Try dijkstra. This is the largest hint.
I hope to reach expert next round :( :(
rainboy orz on astonishing participation! He won't become a GM after this contest but he really deserved it. This strategy of solving the problems starting with the harder ones is really not that bad, especially for educational purposes.
chadboy
The best round recently I think! Thank the author!
small feedback: A is kinda cool, B&C both too standart IMO
Not sure about the complexity of "dive" function in my solution to D: 160848374. If anybody wants to try to create the test were the complexity is worse, you're welcome (don't know if it's correct or not).
I think I did the same thing, guessing that it would work (somehow it did). I would also like to see a proof of why this type of memoization runs in linear time.
Yeah. I’m doing more stuff, but I can believe that the transition is correct.
I am able to solve only problem A.
Glad to see your persistence, try our best to prepare for the next round!
see https://codeforces.net/blog/entry/103952?#comment-923384
UPD: why downvotes ? I simply removed my original post
is "wrong answer jury had better answer" different from "wrong answer expected ,found"?
It's 2 different types of problems: "jury" thingy appears where you have to calculate a minimum or maximum answer for example and at some point there is a possibility to have a better answer than yours, but "expected" simply stands for a wrong answer.
Thanks for the round, Div1 pC was really interesting!
What was the sol for Div2 C?
I solved this problem using RBS (Regular Bracket Sequence) pattern. If you consider the positive numbers as the number of open brackets and the negative numbers as the number of closing brackets, you will see "If the total sequence is regular and it's closed then the answer is yes".
So you will get Yes for ( ()()() ) or ((())) or ( ( () ((())) ) ). But if the bracket is like this ()()() then it's no because in this case you can't get back to the first index.
oh boi!! you're a genius
Wow, Your analogy is interesting. This is a different way to think of problem.
this is really a great intuitive way to see things! Thanks for sharing it
If at any index < last index prefix sum is <= 0 || total sum != 0 then ans is no
here last index is index of last non zero element.
Take care of few edge cases such as all zero elements
Great contest. The problemset was amazing and so fun to solve. Enjoyed this contest so much.
I think the problem setter is a Radiohead fan. Some of the problem title is similar to Radiohead's song title . Or its just a coincidence .
Yeah it says in the announcement.
very good and balanced round + interesting problems. Though I FSTed on div2c but was a silly mistake.
Overall thanks for the amazing round
whats fst??
Failed System Testing
How to solve Div2 D problem?
do DFS on the tree.
if the node children returned a number which is greater than or equal lv, just return the min of the returned value of the children and the rv
if it is less than the lv, you need to make another operation to fix this issue, so you will increase sol by one, then you will need to return rv.
But how do you prove that the configurations doesn't matter?
In the sense , say a node has value 5.. 5 can be written as [1,1,3] , [1,2,2] and so on. But in your solution , you just see the min(sum, Ri).
Why does your solution work? Proof?
I can't understand what you mean by configuration and why there are 3 numbers in your examples.
I am not good at writing formal mathematical proofs, but I will try to proof it logically.
The current node doesn't care how many nodes under it, it only cares about the maximum value they all need, because it is the maximum value I can give to the current node, I can decrease it if I want, but I cannot increase it without an additional operation.
But notice that the sum of all the child nodes values may be greater than Rv, so I take the min of them
Can anyone tell the testcase for which my submission is failing (Div2C):- Submission
You can use this app to get more samples (stress testing is not working for unknown reasons): https://cfstress.com/test/1694/c/
logic is right, just use long instead of int for sum.
luck maatters much in life
can someone tell me why i got tle'd in this submission https://codeforces.net/contest/1694/submission/160921292 Thank you
Pass vector<pair<int,int>>range by reference to dfs function, also use long long for sum
Thank you