結果
問題 |
No.408 五輪ピック
|
ユーザー |
![]() |
提出日時 | 2018-11-12 16:39:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 921 bytes |
コンパイル時間 | 2,306 ms |
コンパイル使用メモリ | 203,896 KB |
最終ジャッジ日時 | 2025-01-06 16:30:42 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 WA * 3 |
ソースコード
#include<bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} //INSERT ABOVE HERE signed main(){ int n,m; cin>>n>>m; vector<vector<int> > G(n); for(int i=0;i<m;i++){ int a,b; cin>>a>>b; a--;b--; G[a].emplace_back(b); G[b].emplace_back(a); } vector<set<int> > vs(n); for(int v:G[0]){ for(int u:G[v]){ if(u!=0) vs[u].emplace(v); if(vs[u].size()>5u) vs[u].erase(vs[u].begin()); } } auto YES=[](){cout<<"YES"<<endl;exit(0);}; for(int v=1;v<n;v++){ if(vs[v].empty()) continue; for(int u:G[v]){ if(u==0) continue; if(vs[u].empty()) continue; for(int x:vs[v]) for(int y:vs[u]) if(x!=y) YES(); } } cout<<"NO"<<endl; return 0; }