結果

問題 No.2402 Dirty Stairs and Shoes
ユーザー ripityripity
提出日時 2023-08-04 21:42:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 663 bytes
コンパイル時間 4,284 ms
コンパイル使用メモリ 260,476 KB
実行使用メモリ 14,692 KB
最終ジャッジ日時 2023-08-23 01:42:22
合計ジャッジ時間 5,880 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 32 ms
8,896 KB
testcase_04 AC 5 ms
4,380 KB
testcase_05 AC 52 ms
14,164 KB
testcase_06 AC 17 ms
6,200 KB
testcase_07 AC 7 ms
4,376 KB
testcase_08 AC 10 ms
5,464 KB
testcase_09 AC 17 ms
7,608 KB
testcase_10 AC 30 ms
9,188 KB
testcase_11 AC 18 ms
6,112 KB
testcase_12 AC 8 ms
4,380 KB
testcase_13 AC 13 ms
10,072 KB
testcase_14 AC 19 ms
14,692 KB
testcase_15 AC 12 ms
9,896 KB
testcase_16 AC 6 ms
5,724 KB
testcase_17 AC 15 ms
11,744 KB
testcase_18 AC 12 ms
9,364 KB
testcase_19 AC 18 ms
13,056 KB
testcase_20 AC 15 ms
11,484 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 8 ms
7,352 KB
testcase_23 AC 7 ms
6,908 KB
testcase_24 AC 8 ms
7,040 KB
testcase_25 AC 17 ms
13,180 KB
testcase_26 AC 9 ms
7,432 KB
testcase_27 AC 18 ms
13,408 KB
testcase_28 AC 14 ms
10,208 KB
testcase_29 AC 8 ms
7,372 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 18 ms
13,564 KB
testcase_32 AC 8 ms
7,048 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 7 ms
6,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> mat(N+1), dirty(N+1);
	vector<vector<int>> dp(N+1, vector<int>(2));
	int M;
	cin >> M;
	while(M--) {
		int A;
		cin >> A;
		dirty[A] = true;
	}
	cin >> M;
	while(M--) {
		int B;
		cin >> B;
		mat[B] = true;
	}
	dp[0][0] = true;
	for( int i = 0; i < N; i++ ) {
		for( int k : {1, K} ) {
			if( i+k <= N ) {
				dp[i+k][0] |= dp[i][0]&(!dirty[i+k]);
				dp[i+k][0] |= mat[i+k];
				dp[i+k][1] |= dp[i][0]&dirty[i+k];
				dp[i+k][1] |= dp[i][1]&(!mat[i+k]);
			}
		}
	}
	cout << ( dp[N][0] ? "Yes" : "No" ) << endl;
}
0