結果

問題 No.408 五輪ピック
ユーザー snrnsidysnrnsidy
提出日時 2021-06-14 23:33:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 657 bytes
コンパイル時間 2,265 ms
コンパイル使用メモリ 200,948 KB
実行使用メモリ 5,052 KB
最終ジャッジ日時 2023-08-26 12:46:08
合計ジャッジ時間 5,252 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 10 ms
4,552 KB
testcase_06 AC 9 ms
4,788 KB
testcase_07 AC 12 ms
4,688 KB
testcase_08 AC 9 ms
4,632 KB
testcase_09 AC 10 ms
4,528 KB
testcase_10 WA -
testcase_11 AC 8 ms
4,448 KB
testcase_12 AC 13 ms
4,784 KB
testcase_13 AC 11 ms
4,780 KB
testcase_14 WA -
testcase_15 AC 10 ms
4,536 KB
testcase_16 AC 12 ms
4,644 KB
testcase_17 AC 13 ms
4,816 KB
testcase_18 AC 13 ms
4,728 KB
testcase_19 AC 15 ms
4,848 KB
testcase_20 AC 5 ms
4,384 KB
testcase_21 AC 4 ms
4,480 KB
testcase_22 AC 8 ms
4,604 KB
testcase_23 AC 16 ms
4,936 KB
testcase_24 WA -
testcase_25 AC 10 ms
4,640 KB
testcase_26 AC 16 ms
5,052 KB
testcase_27 AC 10 ms
4,504 KB
testcase_28 AC 9 ms
4,496 KB
testcase_29 AC 9 ms
4,456 KB
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
	}

	for (int i = 1; i <= 1; i++)
	{
		memset(dp, false, sizeof(dp));
		dp[0][i] = 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][i])
		{
			cout << "YES" << '\n';
			return 0;
		}
	}

	cout << "NO" << '\n';

	return 0;
}
0