問題一覧 > 通常問題

No.1563 Same Degree

レベル : / AI推定難易度 : 167 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 138
作問者 : maguro / テスター : blackyuki PCTprobability
お気に入りにしたユーザー ProblemId : 6280 / 自分の提出
問題文最終更新日: 2021-06-25 21:30:37
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
灘校文化祭コンテスト 2021 day1 (順位表) の他の問題:

Problem Statement

You are given a simple graph $G$ with $N$ vertices and $M$ edges. The $i\ (1 \leq i \leq M)$-th edge connects vertex $u_i$ and vertex $v_i$.

Does $G$ have a pair of vertices $(a,b)\ (a \neq b)$ with equal degrees?

You are given $T$ cases; find the answer for each of them.

Input

$T$
$case_1$
$case_2$
$\vdots$
$case_T$

Each case is given in the following format.

$N\ M$
$u_1\ v_1$
$u_2\ v_2$
$\vdots$
$u_M\ v_M$

  • All inputs are integers.
  • $1 \leq T \leq 10^4$
  • $1 \leq N \leq 10^5$
  • $0 \leq M \leq 2 \times 10^5$
  • $1 \leq u_i,v_i \leq N$
  • $u_i \neq v_i$
  • $(u_i,v_i) \neq (u_j,v_j)\ (i \neq j)$
  • $(u_i,v_i) \neq (v_j,u_j)\ (i \neq j)$
  • In $1$ test case, the sum of $N$ does not exceed $10^5$.
  • In $1$ test case, the sum of $M$ does not exceed $2 \times 10^5$.

Output

Output $T$ lines.

On the $i\ (1 \leq i \leq N)$-th line, for $case_i$, print Yes if a pair of vertices with equal degrees exists, and No otherwise. Print a newline at the end.

Sample

Sample 1
Input
2
5 5
1 3
2 5
5 3
4 2
2 1
2 1
1 2
Output
Yes
Yes

In the $1$st case, for example, vertex $1$ and vertex $3$ both have degree $2$.

In the $2$nd case, vertex $1$ and vertex $2$ both have degree $1$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。