結果
| 問題 |
No.408 五輪ピック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-23 22:51:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,220 bytes |
| コンパイル時間 | 1,931 ms |
| コンパイル使用メモリ | 197,536 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-23 22:51:13 |
| 合計ジャッジ時間 | 3,238 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 WA * 2 |
ソースコード
#include <bits/stdc++.h>
#define maxn 20005
namespace CZS_Office{
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
return x*f;
}
inline void write(int x){
if(x<0){
putchar('-');
x=-x;
}
if(x>9)write(x/10);
putchar(x%10+'0');
return;
}
}
using namespace std;
using namespace CZS_Office;
int n,m,cnt[maxn];bool NTT[maxn],gogoCZS[maxn];
vector<int>edge[maxn],bridge[maxn];
inline bool check(int c,int d){
if(cnt[c]>=3||cnt[d]>=3)return 1;
vector<int>cur;
for(auto b:bridge[c]){
if(b==1||b==d||b==c)continue;
for(auto e:bridge[d]){
if(e==1||e==b||e==c||e==d)continue;
return 1;
}
}
return 0;
}
signed main(){
n=read();m=read();
for(int i=1;i<=m;++i){
int u=read(),v=read();
edge[u].push_back(v);
edge[v].push_back(u);
if(u==1)gogoCZS[v]=1;
if(v==1)gogoCZS[u]=1;
}
for(auto b:edge[1]){
for(auto c:edge[b]){
++cnt[c];NTT[c]=1;
bridge[c].push_back(b);
}
}
for(int c=1;c<=n;++c){
if(!NTT[c])continue;
for(auto d:edge[c]){
if(!NTT[d])continue;
if(check(c,d)){
cout<<"YES";
return 0;
}
}
}
cout<<"NO";
return 0;
}