結果

問題 No.3067 +10 Seconds Clock
ユーザー nikoro256
提出日時 2025-03-21 21:53:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 137,420 KB
最終ジャッジ日時 2025-03-21 21:53:29
合計ジャッジ時間 3,935 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def binary_search(f):
    left,right=-1,10**6
    if f(left):
        return 0
    if not f(right):
        return -1
    while right-left>1:
        mid=(right+left)//2
        if f(mid):
            right=mid
        else:
            left=mid
    return right

def f(x):
    time=T
    c=0
    for i in range(N-1):
        if c<x and i+1 in X:
            time+=10
            c+=1
        time-=t[i]
        if time<=0:
            return False
    return True

print(binary_search(f))   
0