結果

問題 No.3067 +10 Seconds Clock
ユーザー Shirotsume
提出日時 2025-03-21 21:59:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 646 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 82,412 KB
実行使用メモリ 111,460 KB
最終ジャッジ日時 2025-03-21 21:59:31
合計ジャッジ時間 4,051 ms
ジャッジサーバーID
(参考情報)
judge7 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
def debug(*x):print('debug:',*x, file=sys.stderr)
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353

n, t = mi()

d = li()

k = ii()

x = li()

clock = [0] * n

for i in range(k):
    clock[x[i] - 1] += 1


cnt = 0
ans = 0
for i in range(n - 1):
    if clock[i] > 0:
        cnt += 1
    while t - d[i] <= 0:
        if cnt == 0:
            print(-1)
            exit()
        t += 10
        ans += 1
        cnt -= 1
    t -= d[i]
    
print(ans)
0