結果

問題 No.408 五輪ピック
ユーザー latte0119latte0119
提出日時 2016-08-05 22:45:41
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,384 bytes
コンパイル時間 1,163 ms
コンパイル使用メモリ 161,904 KB
実行使用メモリ 7,188 KB
最終ジャッジ日時 2024-04-24 15:57:54
合計ジャッジ時間 2,625 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 23 ms
6,144 KB
testcase_06 AC 16 ms
5,376 KB
testcase_07 AC 23 ms
6,016 KB
testcase_08 AC 18 ms
5,760 KB
testcase_09 AC 20 ms
5,888 KB
testcase_10 AC 16 ms
5,504 KB
testcase_11 AC 15 ms
5,376 KB
testcase_12 AC 27 ms
6,272 KB
testcase_13 AC 23 ms
6,528 KB
testcase_14 AC 7 ms
5,376 KB
testcase_15 AC 23 ms
6,784 KB
testcase_16 AC 26 ms
6,272 KB
testcase_17 AC 28 ms
6,400 KB
testcase_18 AC 29 ms
6,400 KB
testcase_19 AC 31 ms
6,528 KB
testcase_20 AC 9 ms
5,376 KB
testcase_21 AC 5 ms
5,376 KB
testcase_22 AC 13 ms
5,376 KB
testcase_23 AC 33 ms
7,188 KB
testcase_24 WA -
testcase_25 AC 23 ms
7,168 KB
testcase_26 AC 33 ms
6,656 KB
testcase_27 AC 24 ms
7,040 KB
testcase_28 AC 18 ms
5,888 KB
testcase_29 AC 19 ms
5,760 KB
testcase_30 WA -
testcase_31 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,M;
vint G[20000];

bool f[20000];
int A[50000],B[50000];

vint T[20000];

signed main(){
    cin>>N>>M;
    rep(i,M){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].pb(b);G[b].pb(a);
        A[i]=a;B[i]=b;
    }


    for(auto v:G[0])f[v]=true;


    rep(i,N)for(auto u:G[i]){
        if(f[u])T[i].pb(u);
    }

    rep(i,M){
        if(A[i]==1||B[i]==1)continue;
        for(int j=0;j<min((int)T[A[i]].size(),3ll);j++){
            for(int k=0;k<min((int)T[B[i]].size(),3ll);k++){
                int a=T[A[i]][j];
                int b=T[B[i]][k];
                if(a==B[i])continue;
                if(b==A[i])continue;
                if(a==b)continue;
                cout<<"YES"<<endl;
                return 0;
            }
        }
    }

    cout<<"NO"<<endl;
    return 0;
}
0