結果
問題 |
No.408 五輪ピック
|
ユーザー |
|
提出日時 | 2021-06-14 23:35:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 1,904 ms |
コンパイル使用メモリ | 195,824 KB |
最終ジャッジ日時 | 2025-01-22 08:18:25 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool dp[6][20001]; vector <int> adj[20001]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n, m, a, b; cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a >> b; adj[a].push_back(b); adj[b].push_back(a); } dp[0][1] = true; for (int j = 0; j < 5; j++) { for (int k = 1; k <= n; k++) { if (dp[j][k] == false) continue; for (auto u : adj[k]) { dp[j + 1][u] = true; } } } if (dp[5][1]) { cout << "YES" << '\n'; //return 0; } else { cout << "NO" << '\n'; } return 0; }