結果

問題 No.1563 Same Degree
ユーザー blackyuki
提出日時 2021-04-14 21:59:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 577 bytes
コンパイル時間 1,942 ms
コンパイル使用メモリ 199,424 KB
最終ジャッジ日時 2025-01-20 17:44:08
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other WA * 2 RE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(){
    int n,m;cin>>n>>m;
    set<P> al;
    std::vector<int> cnt(n);
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;
        assert(1<=a&&a<=n);
        assert(1<=b&&b<=n);
        assert(a!=b);
        al.insert(P(min(a,b),max(a,b)));
        cnt[a-1]++;cnt[b-1]++;
    }
    assert(al.size()==m);
    vector<int> cnt2(n);
    for(int i=0;i<n;i++)cnt2[cnt[i]]++;
    for(int i=0;i<n;i++){
        if(cnt2[i]>1){
            cout<<"Yes"<<endl;return 0;
        }
    }
    cout<<"No"<<endl;
}
0