結果

問題 No.3067 +10 Seconds Clock
ユーザー ルク
提出日時 2025-03-21 21:37:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 113,316 KB
最終ジャッジ日時 2025-03-21 21:37:57
合計ジャッジ時間 3,158 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 1 RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

n, t = map(int, input().split())
a = list(map(int, input().split()))
k = int(input())
x = list(map(int, input().split()))
x.reverse()
cnt = 0
for i in range(n-1):
    t -= a[i]
    if t <= 0 and -((t-1)//10) <= cnt:
        cnt -= -((t-1)//10)
        t += 10*-((t-1)//10)
    if t <= 0 and cnt == 0:
        exit(print(-1))
    if x[-1] == i+1:
        cnt += 1
        x.pop()

if t <= 0 and -((t-1)//10) <= cnt:
    cnt -= -((t-1)//10)
    t += 10*-((t-1)//10)
if t <= 0 and cnt == 0:
    exit(print(-1))
print(k-cnt)
0