

Time Limit: 4 sec / Memory Limit: 1024 MB
配点 : 点
問題文
から までの番号がついた 頂点の単純無向グラフ が与えられます。 は 本の辺を持ち、 本目の辺は頂点 と を結びます。
が次の条件を満たすか判定してください。
- 頂点集合 のすべての部分集合 に対して、 の部分集合 であって かつ がクリークを形成するものが存在する。
解くべきテストケースは 個あります。
制約
- 与えられるグラフは自己辺も多重辺も含まない。
- ひとつの入力の中のテストケースすべてにわたる の総和は 以下である。
- ひとつの入力の中のテストケースすべてにわたる の総和は 以下である。
- すべての入力値は整数である。
入力
入力は標準入力から以下の形式で与えられる。
各テストケースは以下の形式で与えられる。
出力
各テストケースについて、 が条件を満たすなら Yes
、そうでないなら No
と出力せよ。
Yes
または No
の出力において、各文字は大文字・小文字のいずれでもよい。
入力例 1Copy
4 3 3 1 2 1 3 2 3 3 2 1 2 1 3 3 1 1 2 3 0
出力例 1Copy
Yes Yes Yes No
番目のテストケースについて、 は条件を満たします。 この場合、すべての部分集合 がクリークであるため、単に とできます。
番目のテストケースについて、 は条件を満たします。 例えば、 に対しては、 とできます。
番目のテストケースについて、 は条件を満たしません。 とすると、条件を満たす の部分集合 はありません。
Score : points
Problem Statement
You are given a simple undirected graph with vertices numbered to . has edges and the -th edge connects vertices and .
Check if satisfies the following condition:
- For every subset of the vertex set , there exists a subset of such that and forms a clique.
You have testcases to solve.
Constraints
- The given graph doesn't contain self-loops or multiple edges.
- The sum of across the test cases in a single input is at most .
- The sum of across the test cases in a single input is at most .
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Each test case is given in the following format:
Output
For each test case, if satisfies the condition, print Yes
, and otherwise print No
.
In printing Yes
or No
, you can output each letter in any case (upper or lower).
Sample Input 1Copy
4 3 3 1 2 1 3 2 3 3 2 1 2 1 3 3 1 1 2 3 0
Sample Output 1Copy
Yes Yes Yes No
For the -st test case, satisfies the condition. In this case, every subset is a clique, so we can just let .
For the -nd test case, satisfies the condition. For example, for , we can let .
For the -th test case, doesn't satisfy the condition. If we let , no subset of satisfies the condition.