結果

問題 No.1563 Same Degree
ユーザー CleyLCleyL
提出日時 2022-07-09 00:07:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 775 ms
コンパイル使用メモリ 81,280 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-28 09:08:17
合計ジャッジ時間 3,372 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

void solve(){
    int n,m;cin>>n>>m;
    vector<int> A(n);
    for(int i = 0; m > i; i++){
        int x,y;cin>>x>>y;
        A[--x]++;A[--y]++;
    }
    sort(A.begin(),A.end());
    for(int i = 0; n-1 > i; i++){
        if(A[i] == A[i+1]){
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}

int main(){
    int n;cin>>n;
    for(int i = 0; n > i; i++){
        solve();
    }
}
0