atcoder#ARC161F. [ARC161F] Everywhere is Sparser than Whole (Judge)
[ARC161F] Everywhere is Sparser than Whole (Judge)
Score : points
Problem Statement
We define the density of a non-empty simple undirected graph as $\displaystyle\frac{(\text{number\ of\ edges})}{(\text{number\ of\ vertices})}$.
You are given positive integers , , and a simple undirected graph with vertices and edges. The vertices of are numbered from to , and the -th edge connects vertex and vertex . Determine whether satisfies the following condition.
Condition: Let be the vertex set of . For any non-empty proper subset of , the density of the induced subgraph of by is strictly less than .
There are test cases to solve.
What is an induced subgraph?
For a vertex subset of graph , the induced subgraph of by is the graph with vertex set and edge set containing all edges of that connect two vertices in . In the above condition, note that we only consider vertex subsets that are neither empty nor the entire set.
Constraints
- The sum of over the test cases in each input file is at most .
- $(A_i, B_i) \neq (A_j, B_j) \ \ (1 \leq i < j \leq DN)$
Input
The input is given from Standard Input in the following format:
Each test case is in the following format:
Output
Print lines.
The -th line should contain Yes
if the given graph for the -th test case satisfies the condition, and No
otherwise.
2
3 1
1 2
1 3
2 3
4 1
1 2
1 3
2 3
3 4
Yes
No
-
The first test case is the same as Sample Input 1 in Problem D
, and it satisfies the condition.
-
For the second test case, the edge set of the induced subgraph by the non-empty proper subset of the vertex set is , and its density is . Therefore, this graph does not satisfy the condition.