結果

問題 No.3067 +10 Seconds Clock
ユーザー Kude
提出日時 2025-03-21 21:31:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 545 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 115,072 KB
最終ジャッジ日時 2025-03-21 21:31:28
合計ジャッジ時間 3,775 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n, t = map(int, input().split())
a = list(map(int, input().split()))
itm = [0] * n
input()
for x in map(int, input().split()):
    itm[x - 1] = 1
now = 0
ans = 0
for i in range(n - 1):
    # 10*use+t > ti
    # use>(ti-t)/10
    now += itm[i]
    use = max(0, (a[i] - t) // 10 + 1)
    if use > now:
        ans = -1
        break
    ans += use
    now -= use
    t += 10 * use
    t -= a[i]
print(ans)
0