結果
| 問題 |
No.408 五輪ピック
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-04-24 21:26:41 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 45 ms / 5,000 ms |
| コード長 | 785 bytes |
| コンパイル時間 | 3,708 ms |
| コンパイル使用メモリ | 277,960 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-24 21:26:47 |
| 合計ジャッジ時間 | 5,286 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 32 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=20010;
int n,m;
vector<int>G[N];
vector<int>G2[N];
signed main(){
// ios::sync_with_stdio(0);
// cin.tie(0);
// cout.tie(0);
// freopen("circle.in","r",stdin);
// freopen("circle.out","w",stdout);
cin>>n>>m;
for(int i=1;i<=m;i++){
int u,v;
cin>>u>>v;
G[u].push_back(v);
G[v].push_back(u);
}
for(auto v:G[1])
for(auto vv:G[v]){
if(vv==1)continue;
G2[vv].push_back(v);
}
for(int mid=2;mid<=n;mid++)
for(auto l:G2[mid])
for(auto r:G[mid])
for(auto rr:G2[r]){
//1->l->mid->r->rr->1
if(l==1||mid==1||r==1||rr==1)continue;
if((l!=mid&&l!=r&&l!=rr)&&(mid!=r&&mid!=rr)&&r!=rr){
cout<<"YES\n";
return 0;
}
}
cout<<"NO\n";
return 0;
}
/*
*/
vjudge1