結果

問題 No.408 五輪ピック
ユーザー sugarrrsugarrr
提出日時 2018-08-29 00:31:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,313 bytes
コンパイル時間 948 ms
コンパイル使用メモリ 84,856 KB
実行使用メモリ 10,956 KB
最終ジャッジ日時 2023-09-25 16:02:21
合計ジャッジ時間 9,401 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,680 KB
testcase_01 AC 4 ms
5,832 KB
testcase_02 AC 3 ms
5,744 KB
testcase_03 AC 3 ms
5,672 KB
testcase_04 AC 3 ms
5,688 KB
testcase_05 AC 23 ms
6,268 KB
testcase_06 AC 17 ms
6,376 KB
testcase_07 AC 25 ms
6,412 KB
testcase_08 AC 20 ms
6,212 KB
testcase_09 AC 21 ms
6,360 KB
testcase_10 AC 17 ms
6,256 KB
testcase_11 AC 18 ms
6,148 KB
testcase_12 AC 28 ms
6,444 KB
testcase_13 AC 24 ms
6,348 KB
testcase_14 AC 9 ms
5,996 KB
testcase_15 AC 23 ms
6,336 KB
testcase_16 AC 26 ms
6,280 KB
testcase_17 AC 29 ms
6,592 KB
testcase_18 AC 31 ms
6,444 KB
testcase_19 AC 33 ms
6,544 KB
testcase_20 AC 11 ms
6,040 KB
testcase_21 AC 7 ms
5,916 KB
testcase_22 AC 16 ms
6,476 KB
testcase_23 AC 31 ms
6,676 KB
testcase_24 WA -
testcase_25 AC 96 ms
6,412 KB
testcase_26 AC 34 ms
6,672 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}

////////////////////////////////////////




int n,m;
vector<int>v[100005];
bool ans=false;
bool al[100005];

void dfs(int t,int d){
    if(d==5||ans)return;
    else if(d==4){
        for(auto x:v[t])if(x==0){
            ans=true;
        }
    }else{
        for(auto x:v[t]){
            if(!al[x]){
                al[x]=true;
                dfs(x,d+1);
                al[x]=false;
            }
        }
    }
}


int main(){
    cin>>n>>m;
    rep(i,0,m-1){
        int s,t;cin>>s>>t;s--;t--;
        v[s].pb(t);
        v[t].pb(s);
    }
    dfs(0,0);
    rep(i,1,n-1)al[i]=false;al[0]=true;
    if(ans)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    
    return 0;
}
0