結果
問題 |
No.2650 [Cherry 6th Tune *] セイジャク
|
ユーザー |
![]() |
提出日時 | 2024-02-23 23:20:13 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 481 bytes |
コンパイル時間 | 518 ms |
コンパイル使用メモリ | 82,584 KB |
実行使用メモリ | 121,592 KB |
最終ジャッジ日時 | 2024-09-29 08:51:38 |
合計ジャッジ時間 | 22,794 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 elif y==1: while len(p)>0 and v[-p[0]]==0: heappop(p) if len(p)>0: ans[z]=-p[0]+1 elif y==2: v[z]=0 print(*ans,sep="\n")