結果
| 問題 |
No.2402 Dirty Stairs and Shoes
|
| コンテスト | |
| ユーザー |
amentorimaru
|
| 提出日時 | 2023-07-29 00:42:41 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 2,000 ms |
| コード長 | 620 bytes |
| コンパイル時間 | 97 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 26,420 KB |
| 最終ジャッジ日時 | 2024-12-20 02:21:35 |
| 合計ジャッジ時間 | 2,459 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
import sys
input = sys.stdin.readline
def read_values(): return tuple(map(int, input().split()))
def main():
N,K = read_values()
M1=int(input())
A = set(map(int,input().split()))
M2=int(input())
B = set(map(int,input().split()))
B.add(0)
dp=[0]*(N+1)
dp[N]=1
for i in range(N,-1,-1):
if dp[i]==0:
continue
for s in [1,K]:
if i >= s and not i - s in A:
dp[i - s] = 1
if i - s in B:
print("Yes")
return
print("No")
if __name__ == "__main__":
main()
amentorimaru