結果

問題 No.408 五輪ピック
ユーザー beet
提出日時 2018-11-12 16:41:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 850 bytes
コンパイル時間 2,432 ms
コンパイル使用メモリ 205,112 KB
最終ジャッジ日時 2025-01-06 16:30:51
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#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()>10u) vs[u].erase(vs[u].begin());      
    }
  }
  auto YES=[](){cout<<"YES"<<endl;exit(0);};
  for(int v=0;v<n;v++){
    for(int u:G[v]){
      if(v==0||u==0) continue;
      for(int x:vs[v])
        for(int y:vs[u])
          if(x!=y) YES();      
    }
  }
  cout<<"NO"<<endl;
  return 0;
}
0