結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー sasa8uyauyasasa8uyauya
提出日時 2024-02-24 00:17:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,335 ms / 2,500 ms
コード長 468 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 122,080 KB
最終ジャッジ日時 2024-04-20 12:32:52
合計ジャッジ時間 33,262 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,224 KB
testcase_01 AC 41 ms
52,480 KB
testcase_02 AC 339 ms
93,056 KB
testcase_03 AC 229 ms
83,260 KB
testcase_04 AC 937 ms
108,948 KB
testcase_05 AC 698 ms
99,412 KB
testcase_06 AC 390 ms
89,252 KB
testcase_07 AC 787 ms
102,500 KB
testcase_08 AC 294 ms
86,636 KB
testcase_09 AC 1,284 ms
121,936 KB
testcase_10 AC 1,323 ms
120,548 KB
testcase_11 AC 1,259 ms
121,324 KB
testcase_12 AC 1,302 ms
121,064 KB
testcase_13 AC 1,335 ms
120,976 KB
testcase_14 AC 1,282 ms
121,152 KB
testcase_15 AC 1,271 ms
119,676 KB
testcase_16 AC 1,227 ms
119,808 KB
testcase_17 AC 1,219 ms
120,356 KB
testcase_18 AC 1,238 ms
120,048 KB
testcase_19 AC 1,238 ms
119,644 KB
testcase_20 AC 1,232 ms
119,656 KB
testcase_21 AC 1,218 ms
119,508 KB
testcase_22 AC 1,242 ms
119,784 KB
testcase_23 AC 720 ms
119,676 KB
testcase_24 AC 717 ms
119,532 KB
testcase_25 AC 735 ms
119,560 KB
testcase_26 AC 728 ms
119,140 KB
testcase_27 AC 719 ms
119,268 KB
testcase_28 AC 729 ms
119,672 KB
testcase_29 AC 733 ms
120,304 KB
testcase_30 AC 968 ms
119,528 KB
testcase_31 AC 865 ms
122,080 KB
testcase_32 AC 539 ms
98,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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")
0