結果

問題 No.2155 みちらcolor
ユーザー wanui
提出日時 2022-12-09 21:57:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-10-14 21:52:17
合計ジャッジ時間 5,254 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,l=map(int,input().split())
a=list(map(int,input().split()))

memo=[None]*102
for i in range(102):
    row = list()
    row.append(-1)
    memo[i] = row*1002

def dp(i,x):
    if(memo[i][x]>=0):
        return memo[i][x]
    if i==n:
        if x==m:
            memo[i][x]=1
        else:
            memo[i][x]=0
        return memo[i][x]
    nx = (x+a[i])//2
    ans = dp(i+1,nx) + dp(i+1,x)
    memo[i][x]= min(ans,1)
    return memo[i][x]

print("Yes" if dp(0,l) > 0 else "No")
0