結果

問題 No.3067 +10 Seconds Clock
コンテスト
ユーザー rin204
提出日時 2025-03-21 21:24:59
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 522 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 237 ms
コンパイル使用メモリ 96,372 KB
実行使用メモリ 134,724 KB
最終ジャッジ日時 2026-07-07 14:11:07
合計ジャッジ時間 4,771 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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