結果

問題 No.3067 +10 Seconds Clock
ユーザー 👑 rin204
提出日時 2025-03-21 21:24:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 1,605 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 113,152 KB
最終ジャッジ日時 2025-03-21 21:25:05
合計ジャッジ時間 4,583 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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()))

l = -1
r = k + 1


def ok(x):
    a = T_
    xp = 0
    pos = 1
    for t in T:
        a -= t
        if a <= 0:
            return False
        pos += 1
        if xp < x and X[xp] == pos:
            a += 10
            xp += 1

    return True


while r - l > 1:
    mid = (l + r) // 2
    if ok(mid):
        r = mid
    else:
        l = mid

if r == k + 1:
    print(-1)
else:
    print(r)
0