結果

問題 No.3067 +10 Seconds Clock
ユーザー i_taku
提出日時 2025-03-25 16:13:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 82,644 KB
実行使用メモリ 130,108 KB
最終ジャッジ日時 2025-03-25 16:13:10
合計ジャッジ時間 4,366 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(x):
    cur = T
    for i in range(N - 1):
        if cur >= 1 and i + 1 in X and x > 0:
            cur += 10
            x -= 1
        cur -= ts[i]
        if cur <= 0:
            return False
    return True

N, T = map(int, input().split())
ts = list(map(int, input().split()))
K = int(input())
X = set(map(int, input().split()))

if not check(K):
    print('-1')
    exit()

ok = K
ng = -1
while ok - ng > 1:
    mid = (ok + ng) // 2
    if check(mid):
        ok = mid
    else:
        ng = mid
print(ok)
0