結果
| 問題 | No.2650 [Cherry 6th Tune *] セイジャク |
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2024-02-23 22:39:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 540 bytes |
| 記録 | |
| コンパイル時間 | 400 ms |
| コンパイル使用メモリ | 82,036 KB |
| 実行使用メモリ | 123,716 KB |
| 最終ジャッジ日時 | 2024-09-29 07:43:41 |
| 合計ジャッジ時間 | 26,094 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 WA * 30 |
ソースコード
n,a=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
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:
u=-1
while len(p)>0:
u=-heappop(p)
if v[u]:
break
else:
u=-1
if u>=0:
ans[z]=u+1
heappush(p,-u)
if y==2:
v[z]=0
print(*ans,sep="\n")
sasa8uyauya