結果

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

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
#n = int(input())
#
#alist = []
#s = input()
n,t = map(int,input().split())
a = list(map(int,input().split()))
k = int(input())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
b = set(map(lambda x:int(x)-1,input().split()))
l,r = 0,k
for _ in range(20):
    mid = (l+r)//2
    now = 0
    cnt = t
    mm = mid
    f = 1
    for i in range(n-1):
        cnt -= a[i]
        if cnt <= 0:
            f = 0
            break
        if mm > 0 and i+1 in b:
            mm -= 1
            cnt += 10
    if f == 0:
        l = mid
    else:
        r = mid

    
for mid in range(r-3,r+3):
    if mid < 0:
        continue
    now = 0
    cnt = t
    mm = mid
    f = 1
    for i in range(n-1):
        cnt -= a[i]
        if cnt <= 0:
            f = 0
            break
        if mm > 0 and i+1 in b:
            mm -= 1
            cnt += 10
    if f == 1:
        exit(print(mid))
print(-1)
0