This round will be rated for Div. 2. It will be held on extented ACM ICPC rules. After the end of the contest you will have one day to hack any solution you want. You will have access to copy any solution and test it locally.

Intended solution is to build the following network: for chosen k, connect the source to every vertex of the first part with edge with capacity d(x) - k (where d(x) is the degree of vertex), then transform every edge of the original graph into a directed edge with capacity 1, and then connect each vertex from the second part to the sink with capacity d(x) - k. Then edges saturated by the maxflow are not present in the answer (and all other edges are in the answer).

To solve it fastly, we might just iterate on k from its greatest value to 0 and each time augment the flow we found on previous iteration. Since maxflow in the network is at most m, and we will do not more than m searches that don't augment the flow, this solution is quadratic.

There's also other solution. Iterate on k from 0 to greatest value and gradually increment the capacity of edges from source/to sink by 1 (so it becomes k in each step). The answer is the saturated edges + any other edges that you choose to make degree[u] < k higher up until k. In other words, the edges from max flow cover 2 vertices and the rest covers just 1 and the answer is k * (n1 + n2) — maxflow.

You may sort the pairs of {L,R} in non-decreasing L's, if two elements have the same L value, the element with bigger R get the smaller index. By sorting, you can check the R values only (because you are sure that the L value of the current element is bigger than or equal all previous elements) and if you found an R value that is smaller than the previous R value, then you've found the answer (which is the element we are currently at and the one directly before it).

Sort all segments by their left border and keep track of the segment with the greatest right border on prefix. Now when you are considering segment i, all the previous ones have less left border and you only have to check whether the right border on the corresponding prefix is no less that yours.

Why can't we in E use the first spell only for one creature? When we are using the first spell it has sense only when hp will be bigger then dmg and if we use the first spell for two creatures then one of the creatures had bigger dmg do we could use first spells from the one with smaller dmg.

9 5 (ans = 36) I had an issue because I was finding the best creature to use the As on as the creature such that power after A — (max of hp and atk) was maximal. However, in that case, 10 7 and 10 6 are treated the same but they really shouldn't be

why is it that in problem F, calling a maxFlow algorithm for every degree <= minDeg is within time constrains, shouldn't it be O(minDeg*V^2*E) — if we use Dinic for example.

UPD: I think this maybe because the graph can be very sparse, if you have for example all 2000 vertexes on both sides then m = 2000 implies that minDeg <= 1, so only one call to maxFlow will be needed. On the other hand, I think in the worst case minDeg will be O(sqrt(m))

Most probably yes. They have finished the system testing just now and it is hardly a matter of time that rating changes will start reflecting. Since round 478 is still around 5 hours away so most probably you will be able to participate in div.1 if you have made it to div.1 after system testings.

Firstly, never use implicit cast but use static_cast instead. Secondly, you cast long long to double which leads to undefined behavior. E.g. the same code gives the correct answer on C++17 compiler. Try to cast it to long double instead.

To be more precise, it causes implementation defined behavior (depends on the platform and/or compiler version). Nevertheless, double usually has only 53 bits of mantissa, which is not enough to store every long long integer, and you definitely should see a compiler warning if you haven't disabled any. Why implementation defined? Because each compiler acts in a different way. So depending on the compiler version, optimization level and other factors you can get different results, e.g. possible auto-conversion to long double and vice versa.