結果
問題 |
No.3198 Monotonic Query
|
ユーザー |
|
提出日時 | 2025-07-11 21:54:13 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 514 bytes |
コンパイル時間 | 306 ms |
コンパイル使用メモリ | 82,356 KB |
実行使用メモリ | 104,216 KB |
最終ジャッジ日時 | 2025-07-12 10:54:29 |
合計ジャッジ時間 | 9,037 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 21 |
ソースコード
Q=int(input()) A=[] for _ in range(Q): q=list(map(int,input().split())) if q[0]==1: if len(A)==0 or q[1]<A[-1][0]: A.append([q[1],1]) else: A[-1][0]=q[1] A[-1][1]+=1 while len(A)>=2 and A[-1][0]>=A[-2][0]: v,cnt=A.pop() A[-1][0]=v A[-1][1]+=cnt else: i=0 mx=0 while q[1]>0: i-=1 q[1]-=A[i][1] mx=max(mx,A[i][0]) print(mx)