結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー tassei903tassei903
提出日時 2024-02-23 21:39:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 873 ms / 2,500 ms
コード長 969 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 235,636 KB
最終ジャッジ日時 2024-02-23 21:40:04
合計ジャッジ時間 24,111 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,608 KB
testcase_01 AC 40 ms
55,608 KB
testcase_02 AC 276 ms
116,876 KB
testcase_03 AC 188 ms
97,760 KB
testcase_04 AC 619 ms
176,528 KB
testcase_05 AC 510 ms
150,988 KB
testcase_06 AC 291 ms
116,864 KB
testcase_07 AC 524 ms
167,776 KB
testcase_08 AC 224 ms
106,124 KB
testcase_09 AC 817 ms
207,436 KB
testcase_10 AC 873 ms
215,796 KB
testcase_11 AC 835 ms
216,104 KB
testcase_12 AC 822 ms
212,540 KB
testcase_13 AC 810 ms
211,696 KB
testcase_14 AC 819 ms
220,348 KB
testcase_15 AC 797 ms
213,224 KB
testcase_16 AC 846 ms
213,900 KB
testcase_17 AC 836 ms
220,440 KB
testcase_18 AC 808 ms
213,924 KB
testcase_19 AC 870 ms
210,488 KB
testcase_20 AC 847 ms
212,632 KB
testcase_21 AC 831 ms
220,696 KB
testcase_22 AC 851 ms
210,228 KB
testcase_23 AC 733 ms
213,040 KB
testcase_24 AC 752 ms
224,136 KB
testcase_25 AC 734 ms
229,008 KB
testcase_26 AC 737 ms
223,608 KB
testcase_27 AC 766 ms
218,388 KB
testcase_28 AC 742 ms
224,124 KB
testcase_29 AC 776 ms
224,136 KB
testcase_30 AC 818 ms
235,636 KB
testcase_31 AC 740 ms
229,968 KB
testcase_32 AC 306 ms
135,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes")
no = lambda :print("no");No = lambda :print("No")
#######################################################################

N, A = na()
X = na()
T = ni()
from collections import defaultdict
s_in = defaultdict(list)
s_out = defaultdict(list)
p = defaultdict(list)

for i in range(T):
    l, r = na()
    s_in[l].append(i)
    s_out[r].append(i)

for i in range(N):
    p[X[i]].append(i)

loc = sorted(set(list(s_in)+list(s_out)+list(p)))
from heapq import heappop, heappush
hq = []
ans = [-1] * N
removed = [0] * T
for x in loc:
    for i in s_in[x]:
        heappush(hq, -i)
    for i in p[x]:
        while hq and removed[-hq[0]]:
            heappop(hq)
        if hq:
            j = -hq[0]
            ans[i] = j+1
    for i in s_out[x]:
        removed[i] = 1

for i in ans:
    print(i)
0