結果

問題 No.3067 +10 Seconds Clock
ユーザー SPD_9X2
提出日時 2025-03-22 17:46:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 124,028 KB
最終ジャッジ日時 2025-03-22 17:46:31
合計ジャッジ時間 3,725 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

"""

import sys

N,T = map(int,input().split())
t = list(map(int,input().split()))
K = int(input())
x = set(map(int,input().split()))

now = T
keep = 0
ans = 0

for i in range(N-1):

    T -= t[i]
    if T <= 0:
        cnt = min(keep , - ((T-1)//10) )
        ans += cnt
        T += cnt * 10
        keep -= cnt

        if T <= 0:
            print ("-1")
            sys.exit()
        
    if i+2 in x:
        keep += 1

print (ans)
0