結果

問題 No.1563 Same Degree
ユーザー Yug_min_nullYug_min_null
提出日時 2021-09-05 13:34:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 167,900 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-23 14:11:42
合計ジャッジ時間 3,149 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 30 ms
4,380 KB
testcase_02 AC 30 ms
4,380 KB
testcase_03 AC 30 ms
4,376 KB
testcase_04 AC 32 ms
4,376 KB
testcase_05 AC 31 ms
4,380 KB
testcase_06 AC 35 ms
4,376 KB
testcase_07 AC 35 ms
4,380 KB
testcase_08 AC 34 ms
4,376 KB
testcase_09 AC 34 ms
4,376 KB
testcase_10 AC 34 ms
4,380 KB
testcase_11 AC 13 ms
4,380 KB
testcase_12 AC 26 ms
4,376 KB
testcase_13 AC 71 ms
4,376 KB
testcase_14 AC 83 ms
4,376 KB
testcase_15 AC 55 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int T;
  cin >> T;
  for (int i = 0; i < T; i++){
    int N, M;
    cin >> N >> M;
    vector<int> d(N, 0);
    for (int j = 0; j < M; j++){
      int u, v;
      cin >> u >> v;
      u--;
      v--;
      d[u]++;
      d[v]++;
    }
    vector<bool> used(N + 1, false);
    bool ok = false;
    for (int j = 0; j < N; j++){
      if (used[d[j]]){
        ok = true;
      }
      used[d[j]] = true;
    }
    if (ok){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
0