結果

問題 No.1563 Same Degree
ユーザー siro53
提出日時 2021-11-19 15:54:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 1,839 ms
コンパイル使用メモリ 199,628 KB
最終ジャッジ日時 2025-01-25 19:34:24
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

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