結果

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

ソースコード

diff #

INF = float("inf")

N, T = map(int, input().split())
t_list = list(map(int, input().split()))

K = int(input())
x_set = set(map(int, input().split()))

def check(n):
    time = T
    cnt = 0
    for i, t in enumerate(t_list, start=1):
        if cnt < n and i in x_set:
            time += 10
            cnt += 1
        time -= t
        if time <= 0:
            return False
    return True

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

print(ok if ok <= K else -1)
0