結果

問題 No.408 五輪ピック
ユーザー vjudge1
提出日時 2025-04-24 21:26:18
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 801 bytes
コンパイル時間 3,625 ms
コンパイル使用メモリ 279,104 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-24 21:26:27
合計ジャッジ時間 8,666 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 RE * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=210;
const int M=2010;
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;
}
/*

*/
0