結果

問題 No.1563 Same Degree
ユーザー kekenxkekenx
提出日時 2022-11-17 20:28:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 2,875 ms
コンパイル使用メモリ 209,708 KB
実行使用メモリ 9,104 KB
最終ジャッジ日時 2023-10-19 11:10:32
合計ジャッジ時間 4,740 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 43 ms
4,348 KB
testcase_02 AC 42 ms
4,348 KB
testcase_03 AC 41 ms
4,348 KB
testcase_04 AC 44 ms
4,348 KB
testcase_05 AC 43 ms
4,348 KB
testcase_06 AC 43 ms
4,348 KB
testcase_07 AC 42 ms
4,348 KB
testcase_08 AC 42 ms
4,348 KB
testcase_09 AC 43 ms
4,348 KB
testcase_10 AC 42 ms
4,348 KB
testcase_11 AC 21 ms
6,728 KB
testcase_12 AC 43 ms
7,520 KB
testcase_13 AC 124 ms
8,840 KB
testcase_14 AC 142 ms
9,104 KB
testcase_15 AC 95 ms
8,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

void solve() {
  size_t n, m;
  cin >> n >> m;

  vector<vector<int>> g(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  set<size_t> st;
  for (const auto& edges : g) {
    if (st.find(edges.size()) != st.end()) {
      puts("Yes");
      return;
    }
    st.insert(edges.size());
  }
  puts("No");
}


int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
0