結果
問題 |
No.408 五輪ピック
|
ユーザー |
![]() |
提出日時 | 2025-04-22 21:59:58 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 23 ms / 5,000 ms |
コード長 | 990 bytes |
コンパイル時間 | 3,489 ms |
コンパイル使用メモリ | 278,012 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-22 22:00:04 |
合計ジャッジ時間 | 5,529 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> #define int long long //#define USE_FREOPEN //#define MUL_TEST #define FILENAME "circle" using namespace std; constexpr int N = 2e4 + 5; vector<int> G[N],from[N]; void solve() { int n,m; 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 (int v : G[1]) { for (int c : G[v]) { if (c != 1) { if (from[c].size() < 3) { from[c].push_back(v); } } } } for (int i = 2; i <= n; i++) { for (int c : G[i]) { for (int j : from[i]) { for (int k : from[c]) { if (j != c && j != k && k != i) { cout << "YES\n"; return; } } } } } cout << "NO\n"; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #ifdef USE_FREOPEN freopen(FILENAME ".in","r",stdin); freopen(FILENAME ".out","w",stdout); #endif int _ = 1; #ifdef MUL_TEST cin >> _; #endif while (_--) solve(); _^=_; return 0^_^0; }