Codeforces round 398
Hard contest, I made mistake in every single problem I tried !!!
767B: The Queue(!!!)
-
I didn’t consider the case that other arrival time may be out of the range already
-
My code didn’t consider the case where the queue is empty by the time next client arrives
767C: Garland(!!!)
I did realize that one to decompose the problem is to consider the 2-cut is one cut in the child link + link to the parent itself. But I have to exclude root node from this case, i.e., there are 3 cases to find 2 cuts from a linked tree, notice our focus is link here
1. 2 single cuts in two child siblings
2. 2 cuts from the same child, may include the link from child to the parent (recursive case)
3. a sinlge cut in a child, may include the link from child to the parent, plus the cut on the link from current root to its parent, need to
exclude the link
767D: Cartons of milk(!!!)
The more we buy, more likely we have to throw a carton, so we just bsearch the target number, of course, we will at each try, we will do a 2 pointer scan to move k cartons each day (sorting will be too expensive)
Mistakes I made
1. should sort store milk increasingly, and then take the last size blocks. During iteration, we should go from block start to m, since we
want to consume ealier milk sooner, but overall, take the latest milks
2. Use scanf insteand of cin, or otherwise TLE