結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー sasa8uyauya
提出日時 2024-02-23 22:50:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 444 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 113,888 KB
最終ジャッジ日時 2024-09-29 08:00:08
合計ジャッジ時間 5,935 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 2 TLE * 1 -- * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

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
p=[]
for x,y,z in q:
  if y==0:
    p+=[z]
    v[z]=1
  if y==1:
    p.sort()
    while len(p)>0 and v[p[-1]]==0:
      p.pop()
    if len(p)>0:
      ans[z]=p[-1]+1
  if y==2:
    v[z]=0
print(*ans,sep="\n")
0