結果

問題 No.3198 Monotonic Query
ユーザー Kude
提出日時 2025-07-11 21:28:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 504 ms / 3,000 ms
コード長 371 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 82,160 KB
最終ジャッジ日時 2025-07-12 10:50:25
合計ジャッジ時間 10,357 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
stidx = []
stval = []
now = 0
for _ in range(int(input())):
    t, x = map(int, input().split())
    if t == 1:
        while stval and stval[-1] <= x:
            stval.pop()
            stidx.pop()
        stval.append(x)
        stidx.append(now)
        now += 1
    else:
        i = bisect_left(stidx, now - x)
        print(stval[i])
0