結果
問題 | No.408 五輪ピック |
ユーザー |
![]() |
提出日時 | 2016-08-05 22:44:21 |
言語 | C++11 (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,156 bytes |
コンパイル時間 | 1,652 ms |
コンパイル使用メモリ | 161,928 KB |
実行使用メモリ | 9,216 KB |
最終ジャッジ日時 | 2024-11-07 00:32:02 |
合計ジャッジ時間 | 12,879 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 31 TLE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int N,M; vector<int> E[202020]; int yes[202020]; vector<int> S; bitset<202020> B; void dfs(int cur,int d) { if(d==5) { if(yes[cur]) { _P("YES\n"); exit(0); } return; } int i; FORR(e,E[cur]) { if(B[e]) continue; B[e]=1; dfs(e,d+1); B[e]=0; } } void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>M; FOR(i,M) { cin>>x>>y; E[x-1].push_back(y-1); E[y-1].push_back(x-1); if(x==1) yes[y-1]=1; if(y==1) yes[x-1]=1; } B.set(0); dfs(0,1); _P("NO\n"); } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }