Comments

In B,

"Now build the string for m=0"

How to prove that we can always build for m = 0?

The same trick doesn't work if instead of adding 1e-14 we multiply by 1.00000000001 does multiplying not increase precision?

Yeah why? also what does adding 1e-14 do?

In C, how did this formula come?

ans[i] = ans[j] = (2 * m - a[i].x - (a[j].d == 1 ? a[j].x : -a[j].x)) / 2;

Yes, I second this

+8

I think they studied in the same school, although I'm not sure

$$$0≤a_i≤n$$$, so the size of "temp" should be n+1

For G, would the solution still be the same if in each operation we only delete the edge connecting a and b and add the edge connecting a and c?

You have to use (int)ceil(1.0 * n/2), because large values will be in Scientific floating-point notation

Try n = 1000000000, it outputs "5e+008"

Come on man, don't sabotage everyone's effort like that

0

You can keep track of the number of 1-1 books in the optimal solution, sort the unchosen books, and take the smallest m-k books, print them along with the chosen books

How do I make my $$$nlogn*logn$$$ Binary Search + Prefix Sums solution pass on C?

https://mirror.codeforces.com/contest/1175/submission/85123220

Can someone help in knowing why B was so hard for me? I didn't struggle on C as much as I did in B. Please help me realize what's wrong in my practice and thought process.

if k is odd then we can't choose the Nth element to be part of even indices, similarly if k is even we can't choose the Nth element to be part of odd indices

"The same solution can be simply rephrased as: go from left to right, and remove current vertex if it is at the end of a two-edge path"

I am writing an explanation vis-a-vis the correlation of the sets $$$V_0, V_1, V_2$$$ to the above algorithm,

Let, $$$V_2$$$ represent the set of all the removed vertices.

Now, the vertices that only have incoming edges from $$$V_2$$$ are the "roots" of a sub-graph that has been disconnected from the initial graph, let they be represented by the set $$$V_0$$$, the vertices in $$$V_0$$$ no longer have any incoming edges, therefore, they can't possibly be the endpoints of a path of length 2 or more, so according to the algorithm they don't have to be removed.

Similarly, all the "neighbours" of the vertices in $$$V_0$$$ need not be removed (they are the endpoints of paths of length 1), these "neighbours" form the set $$$V_1$$$.

P.S after reading this you can refer to the editorial for the upper-bound on the number of elements in set $$$V_2$$$, it's exactly $$$4n/7$$$.

"In the very first time we hit a node that has a back-edge, we take the back-edge that goes to the deepest possible node to close our cycle"

Please correct me if I'm wrong, but shouldn't we take the back edge connecting the closest ancestor?

If we take the one connecting the furthest ancestor, then wouldn't the cycle have multiple back edges?

How will it then be a simple cycle?

Edit: My definition of a simple cycle was flawed

Exactly, a good math background is conducive to better ratings at CP platforms.

In problem E, if we change this part of code:
for(auto &it:g[u])
	{
		if(it == par)
			continue;
		pair<int, int> p = dfs(it, u, min(mn, arr[u]));
		a.first += p.first;
		a.second += p.second;
	}
To this:
for(auto &it:g[u])
	{
		if(it == par)
			continue;
		a.first += dfs(it, u, min(mn, arr[u])).first;
		a.second += dfs(it, u, min(mn, arr[u])).second;
	}

It dosen't work, why?

Oh, thank you!

Please correct me if I'm wrong, but consider $$$h=10$$$ and $$$c=1000000$$$

Wouldn't the average temperature for odd cups be strictly increasing in this case?

Please suggest more problems like D that involve a similar prefix sums approach(adding to a segment). There was a question in a recent Div 3 which involved something similar, but I am unable to find more of those questions.

I'm 15 and hoping to be blue :)

It's in queue. Wait for a while

Can anyone suggest more problems like D? The prefix sum approach seemed very cool

+1

Elegant problems and short, concise statements. Thank you for this fine contest!

Weak pretests for Div2A unfortunately :(

+3

Nothing better than rick rolling myself while quarantined :)

Wow, I never noticed the beta in the logo.

Your pepe profile is very haunting