結果
問題 | No.2402 Dirty Stairs and Shoes |
ユーザー |
![]() |
提出日時 | 2023-08-04 23:30:00 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 108 ms / 2,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 263 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,696 KB |
最終ジャッジ日時 | 2024-12-20 02:47:33 |
合計ジャッジ時間 | 3,382 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
import sys input = sys.stdin.readline def main(): N, K = map(int, input().split()) M1 = int(input()) A = list(map(int, input().split())) M2 = int(input()) B = list(map(int, input().split())) ans = [-1] * (N + 1) for i in A: ans[i] = 1 for i in B: ans[i] = 0 for i in range(1, N + 1): if ans[i] == -1 and i < K: ans[i] = ans[i-1] elif ans[i] == -1 and i >= K: ans[i] = min(ans[i-1], ans[i-K]) print("Yes" if ans[N] <= 0 else "No") if __name__ == '__main__': main()