結果
| 問題 |
No.408 五輪ピック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-20 17:39:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 5,000 ms |
| コード長 | 1,634 bytes |
| コンパイル時間 | 2,377 ms |
| コンパイル使用メモリ | 197,676 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-20 17:39:15 |
| 合計ジャッジ時間 | 4,884 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 32 |
ソースコード
#include<bits/stdc++.h>
#define lowbit(x) x & (-x)
#define ls(k) k << 1
#define rs(k) k << 1 | 1
#define fi first
#define se second
#define ctz(x) __builtin_ctz(x)
#define popcnt(x) __builtin_popcount(x)
#define open(s1, s2) freopen(s1, "r", stdin), freopen(s2, "w", stdout);
using namespace std;
typedef __int128 __;
typedef long double lb;
typedef double db;
typedef unsigned long long ull;
typedef long long ll;
bool Begin;
const int N = 2e4 + 10;
inline ll read(){
ll x = 0, f = 1;
char c = getchar();
while(c < '0' || c > '9'){
if(c == '-')
f = -1;
c = getchar();
}
while(c >= '0' && c <= '9'){
x = (x << 1) + (x << 3) + (c ^ 48);
c = getchar();
}
return x * f;
}
inline void write(ll x){
if(x < 0){
putchar('-');
x = -x;
}
if(x > 9)
write(x / 10);
putchar(x % 10 + '0');
}
int n, m, u, v;
vector<int> E[N], V[N];
inline void add(int u, int v){
E[u].push_back(v);
E[v].push_back(u);
}
bool End;
int main(){
n = read(), m = read();
while(m--){
u = read(), v = read();
add(u, v);
}
for(auto u : E[1]){
for(auto v : E[u]){
if(v == 1)
continue;
if((int)V[v].size() < 3)
V[v].push_back(u);
}
}
for(int i = 2; i <= n; ++i){
for(int v : E[i]){
for(int j = 0; j < V[i].size(); ++j){
for(int k = 0; k < V[v].size(); ++k){
if(V[i][j] != v && V[i][j] != V[v][k] && V[v][k] != i){
puts("YES");
return 0;
}
}
}
}
}
puts("NO");
cerr << '\n' << abs(&Begin - &End) / 1048576 << "MB";
return 0;
}