結果
問題 |
No.2402 Dirty Stairs and Shoes
|
ユーザー |
![]() |
提出日時 | 2023-08-04 21:42:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 97 ms / 2,000 ms |
コード長 | 634 bytes |
コンパイル時間 | 510 ms |
コンパイル使用メモリ | 82,464 KB |
実行使用メモリ | 92,860 KB |
最終ジャッジ日時 | 2024-12-20 02:32:44 |
合計ジャッジ時間 | 3,541 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
inp = map(int, ''.join(open(0)).split()) n = next(inp) k = next(inp) # n, k = map(int, input().split()) d = [0] * (n + 1) # input() m1 = next(inp) for _ in range(m1): a = next(inp) d[a] = 1 # for a in map(int, input().split()): # d[a] = 1 # input() m2 = next(inp) for _ in range(m2): b = next(inp) d[b] = 2 # for b in map(int, input().split()): # d[b] = 2 dp = [0] * (n + 1) dp[0] = 2 for i in range(1, n + 1): v = dp[i - 1] if i - k >= 0: v = max(v, dp[i - k]) if d[i] == 1: v = min(v, 1) elif d[i] == 2 and v: v = 2 dp[i] = v print('Yes' if dp[n] == 2 else 'No')