結果

問題 No.1563 Same Degree
ユーザー _umbrella_kasa_umbrella_kasa
提出日時 2021-07-03 09:34:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 769 bytes
コンパイル時間 1,773 ms
コンパイル使用メモリ 173,688 KB
実行使用メモリ 9,124 KB
最終ジャッジ日時 2023-09-12 14:04:16
合計ジャッジ時間 3,311 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 41 ms
4,376 KB
testcase_02 AC 41 ms
4,376 KB
testcase_03 AC 40 ms
4,376 KB
testcase_04 AC 43 ms
4,380 KB
testcase_05 AC 41 ms
4,376 KB
testcase_06 AC 41 ms
4,376 KB
testcase_07 AC 40 ms
4,376 KB
testcase_08 AC 41 ms
4,380 KB
testcase_09 AC 40 ms
4,380 KB
testcase_10 AC 40 ms
4,376 KB
testcase_11 AC 23 ms
6,688 KB
testcase_12 AC 42 ms
7,460 KB
testcase_13 AC 112 ms
8,808 KB
testcase_14 AC 122 ms
9,124 KB
testcase_15 AC 85 ms
8,384 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<vector<int>>G(N+1,vector<int>(0));
        for (int i=0; i<M; i++) {
            int u,v;
            cin >> u >> v;
            G[u].push_back(v);
            G[v].push_back(u);
        }
        vector<int>A(N);
        for (int i=1; i<=N; i++) {
            A[i-1]=G[i].size();
        }
        sort(A.begin(),A.end());
        int count=0;
        for (int i=0; i<N-1; i++) {
            if (A[i]!=A[i+1]) {
                count++;
            }
        }
        if (count==N-1) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
}
0