Problem Description
Problem Analysis
Find the number of feasible ways to divide the problems into two parts.
Because every problem in div1 must be larger than those in div2
and a pair of problems is given that must be in the two different divs
and this relation is not transitive.
So for each given pair
the larger one must be in div1
and the smaller one must be in div2.
At the same time, update the minimum value in div1 and the maximum value in div2.
Finally, if the minimum value in div1 does not exceed the maximum value in div2
then a division is definitely impossible.
Otherwise, the problems between min and max each have two possible divisions
and the rest have one possible division
so the number of ways is min-max.
If no pair relation is given
then the number of ways is n-1.
| |
Problem address: 【CodeForces】[673B]Problems for Round