結果

問題 No.3067 +10 Seconds Clock
ユーザー tkykwtnb
提出日時 2025-04-04 23:37:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 421 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 82,128 KB
実行使用メモリ 849,084 KB
最終ジャッジ日時 2025-04-04 23:37:14
合計ジャッジ時間 6,010 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 WA * 1 MLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N,T=map(int,input().split())
t=list(map(int,input().split()))
K=int(input())
x=set(map(int,input().split()))
dp=[[] for _ in range(N)]
dp[0]=[(0,T)]
for i in range(N-1):
    for cnt,rest in dp[i]:
        if rest-t[i]>0:
            dp[i+1].append((cnt,rest-t[i]))
            if i in x:
                dp[i+1].append((cnt+1,rest-t[i]+10))
if len(dp[N-1]):
    dp[N-1].sort()
    print(dp[N-1][0][0])
else:
    print(-1)
0