結果
| 問題 |
No.2650 [Cherry 6th Tune *] セイジャク
|
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2024-02-24 00:17:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,321 ms / 2,500 ms |
| コード長 | 468 bytes |
| コンパイル時間 | 215 ms |
| コンパイル使用メモリ | 82,428 KB |
| 実行使用メモリ | 121,952 KB |
| 最終ジャッジ日時 | 2024-10-12 07:53:34 |
| 合計ジャッジ時間 | 33,471 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
n,a=map(int,input().split())
x=list(map(int,input().split()))
q=[]
for i in range(n):
q+=[(x[i],1,i)]
t=int(input())
for i in range(t):
l,r=map(int,input().split())
q+=[(l,0,i)]
q+=[(r,2,i)]
q.sort()
ans=[-1]*n
v=[0]*t
from heapq import heappush,heappop
p=[]
for x,y,z in q:
if y==0:
heappush(p,-z)
v[z]=1
if y==1:
while len(p)>0 and v[-p[0]]==0:
heappop(p)
if len(p)>0:
ans[z]=-p[0]+1
if y==2:
v[z]=0
print(*ans,sep="\n")
sasa8uyauya