結果

問題 No.1563 Same Degree
ユーザー siro53siro53
提出日時 2021-11-19 15:54:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 2,076 ms
コンパイル使用メモリ 205,988 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-29 23:29:52
合計ジャッジ時間 4,943 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

#define REP(i, n) for(int i=0;i<(int)(n);i++)

int main() {
    int T;
    cin >> T;
    while(T--) {
        int N, M;
        cin >> N >> M;
        vector<int> deg(N, 0);
        REP(i, M) {
            int a, b;
            cin >> a >> b;
            a--; b--;
            deg[a]++; deg[b]++;
        }
        map<int, int> cnt;
        REP(i, N) cnt[deg[i]] += 1;
        bool ok = false;
        for(auto [a, b] : cnt) if(b >= 2) {
            ok = true;
            break;
        }
        cout << (ok ? "Yes" : "No") << endl;
    }
}
0