結果
問題 |
No.408 五輪ピック
|
ユーザー |
|
提出日時 | 2025-04-23 22:51:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 54 ms / 5,000 ms |
コード長 | 1,323 bytes |
コンパイル時間 | 735 ms |
コンパイル使用メモリ | 95,280 KB |
実行使用メモリ | 51,808 KB |
最終ジャッジ日時 | 2025-04-23 22:51:19 |
合計ジャッジ時間 | 2,875 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
ソースコード
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <vector> #define ll long long #define mst(x, y) memset(x, y, sizeof(x)) #define ciallo putchar('\n') #define ilv inline void #define ili inline int #define ilb inline bool #define ill inline long long constexpr auto N = 1000010; constexpr auto INF = 0x3f3f3f3f; constexpr auto eps = 1e-4; constexpr ll mod = 1e12 + 7; using namespace std; int n, m; vector<int> map[N], t[N]; int main() { // 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; map[u].push_back(v); map[v].push_back(u); } for (auto u : map[1]) for (auto v : map[u]) { if (v == 1) continue; if ((int)t[v].size() < 3) t[v].push_back(u); } for (int i = 2; i <= n; ++i) for (auto v : map[i]) for (int j = 0; j < t[i].size(); ++j) for (int k = 0; k < t[v].size(); ++k) if (t[i][j] != v && t[i][j] != t[v][k] && t[v][k] != i) cout << "YES" << '\n', exit(0); cout << "NO" << '\n'; // fclose(stdin); // fclose(stdout); return 0; }