結果

問題 No.408 五輪ピック
ユーザー 小夫
提出日時 2025-04-25 21:35:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,006 bytes
コンパイル時間 1,999 ms
コンパイル使用メモリ 196,436 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-25 21:35:29
合計ジャッジ時間 3,227 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 26 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h> 
using namespace std;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<48||ch>57)
	{
		if(ch==45)f=-1;
		ch=getchar();
	}
	while(ch>=48&&ch<=57)
	{
		x=(x<<1)+(x<<3)+(ch&15);
		ch=getchar();
	}
	return x*f;
}
inline void write(int x)
{
	if(x<0)x=-x,putchar(45);
	if(x>9)write(x/10);
	putchar(x%10+48);
	return;
}
int n,m,rt;
vector<int>mp[20001];
bool fg=0;
int main()
{
	//freopen("circle.in","r",stdin);
	//freopen("circle.out","w",stdout);
	n=read(),m=read(),rt=1;
	if(n<=4||m<=4){puts("NO");return 0;}
	for(int i=1;i<=m;++i)
	{
		int u=read(),v=read();
		mp[u].emplace_back(v);
		mp[v].emplace_back(u);
	}
	for(auto v1:mp[rt])
	{
		if(fg)break;
		for(auto v2:mp[v1])
		{
			if(fg)break;
			if(v2==rt||v2==v1)continue;
			for(auto v3:mp[v2])
			{
				if(fg)break;
				if(v3==rt||v3==v1||v3==v2)continue;
				for(auto v4:mp[v3])
				{
					if(v4==v1||v4==v2||v4==v3)continue;
					if(v4==rt){fg=1;break;}	
				}
					
			}
		} 
	}
	puts(fg?"YES":"NO");
	return 0;
}
0