結果

問題 No.2155 みちらcolor
ユーザー flippergo
提出日時 2024-10-28 19:45:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 426 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 64,444 KB
最終ジャッジ日時 2024-10-28 19:45:43
合計ジャッジ時間 6,321 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 56 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,L = map(int,input().split())
A = [0]+list(map(int,input().split()))
amax = max(A)
X = max(L,M,amax)
dp = [[False for _ in range(X+1)] for _ in range(N+1)]
dp[1][L] = True
dp[1][A[1]] = True
dp[1][(L+A[1])//2] = True
for i in range(2,N+1):
    for j in range(X+1):
        dp[i][j] = dp[i-1][j]
        if 0<=2*j-A[i]<=X:
            dp[i][j] = dp[i][j]|dp[i-1][2*j-A[i]]
if dp[N][M]:
    print("Yes")
else:
    print("No")
0