AtCoder Regular Contest 161
F
Everywhere is Sparser than Whole (Judge)
AtCoder
⌀ 3106
原题
← E→
翻译中…

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 $N$, $D$, and a simple undirected graph $G$ with $N$ vertices and $DN$ edges. The vertices of $G$ are numbered from $1$ to $N$, and the $i$-th edge connects vertex $A_i$ and vertex $B_i$. Determine whether $G$ satisfies the following condition.

翻译中…

Condition: Let $V$ be the vertex set of $G$. For any non-empty proper subset $X$ of $V$, the density of the induced subgraph of $G$ by $X$ is strictly less than $D$.

翻译中…

There are $T$ test cases to solve.

翻译中…

What is an induced subgraph? For a vertex subset $X$ of graph $G$, the induced subgraph of $G$ by $X$ is the graph with vertex set $X$ and edge set containing all edges of $G$ that connect two vertices in $X$. In the above condition, note that we only consider vertex subsets that are neither empty nor the entire set.

翻译中…

Constraints

翻译中…
  • $T \geq 1$
  • $N \geq 1$
  • $D \geq 1$
  • The sum of $DN$ over the test cases in each input file is at most $5 \times 10^4$.
  • $1 \leq A_i < B_i \leq N \ \ (1 \leq i \leq DN)$
  • $(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:

翻译中…

T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T

翻译中…

Each test case $\mathrm{case}_i \ (1 \leq i \leq T)$ is in the following format:

翻译中…

N D
A_1 B_1
A_2 B_2
\vdots
A_{DN} B_{DN}

翻译中…

Output

翻译中…

Print $T$ lines. The $i$-th line should contain Yes if the given graph $G$ for the $i$-th test case satisfies the condition, and No otherwise.

翻译中…

样例

Input #1
2
3 1
1 2
1 3
2 3
4 1
1 2
1 3
2 3
3 4
Output #1
Yes
No
- The first test case is the same as Sample Input 1 in [Problem D](https://atcoder.jp/contests/arc161/tasks/arc161_d), and it satisfies the condition. - For the second test case, the edge set of the induced subgraph by the non-empty proper subset $\{1, 2, 3\}$ of the vertex set $\{1, 2, 3, 4\}$ is $\{(1, 2), (1, 3), (2, 3)\}$, and its density is $\displaystyle\frac{3}{3} = 1 = D$. Therefore, this graph does not satisfy the condition.
题目信息
题号
arc161_f
时间限制
8 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。