結果

問題 No.3067 +10 Seconds Clock
ユーザー i_taku
提出日時 2025-03-25 16:11:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 130,004 KB
最終ジャッジ日時 2025-03-25 16:11:41
合計ジャッジ時間 4,565 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(x):
    cur = T
    for i in range(N - 1):
        if cur >= 1 and i 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