結果

問題 No.2650 [Cherry 6th Tune *] セイジャク
ユーザー ああいいああいい
提出日時 2024-02-23 21:53:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,668 ms / 2,500 ms
コード長 827 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 139,532 KB
最終ジャッジ日時 2024-04-23 09:21:06
合計ジャッジ時間 42,809 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,864 KB
testcase_01 AC 34 ms
52,608 KB
testcase_02 AC 446 ms
89,312 KB
testcase_03 AC 269 ms
85,320 KB
testcase_04 AC 1,099 ms
124,724 KB
testcase_05 AC 846 ms
111,436 KB
testcase_06 AC 464 ms
94,224 KB
testcase_07 AC 932 ms
117,440 KB
testcase_08 AC 363 ms
88,792 KB
testcase_09 AC 1,643 ms
138,732 KB
testcase_10 AC 1,668 ms
139,532 KB
testcase_11 AC 1,614 ms
137,760 KB
testcase_12 AC 1,635 ms
138,672 KB
testcase_13 AC 1,666 ms
138,288 KB
testcase_14 AC 1,642 ms
139,292 KB
testcase_15 AC 1,619 ms
139,204 KB
testcase_16 AC 1,508 ms
131,780 KB
testcase_17 AC 1,666 ms
131,952 KB
testcase_18 AC 1,506 ms
132,376 KB
testcase_19 AC 1,457 ms
131,768 KB
testcase_20 AC 1,542 ms
133,016 KB
testcase_21 AC 1,496 ms
132,904 KB
testcase_22 AC 1,466 ms
133,480 KB
testcase_23 AC 1,293 ms
132,604 KB
testcase_24 AC 1,298 ms
133,156 KB
testcase_25 AC 1,323 ms
132,620 KB
testcase_26 AC 1,305 ms
133,784 KB
testcase_27 AC 1,320 ms
133,408 KB
testcase_28 AC 1,340 ms
134,356 KB
testcase_29 AC 1,317 ms
133,532 KB
testcase_30 AC 1,372 ms
132,356 KB
testcase_31 AC 1,472 ms
138,508 KB
testcase_32 AC 581 ms
97,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,A = map(int,input().split())

X = list(map(int,input().split()))
T = int(input())

import heapq
#X = [(X[i],i) for i in range(N)]
q = []
for _ in range(T):
    l,r = map(int,input().split())
    q.append((l,r))

h1 = []
h2 = []
for i in  range(T):
    l,r = q[i]
    h1.append((l,-i,1))
    h1.append((r,i + N + 100,2))
for i in range(N):
    x = X[i]
    h1.append((x,i,3))
heapq.heapify(h1)
ans = [-1] * N
s = set()
while h1:
    now,j,f = heapq.heappop(h1)
    if f == 1:
        j = -j
        heapq.heappush(h2,-j)
    elif f == 2:
        j = j - N - 100
        s.add(j)
    else:
        while h2:
            u = -heapq.heappop(h2)
            if u in s:
                continue
            else:
                ans[j] = u + 1
                heapq.heappush(h2,-u)
                break
for a in ans:
    print(a)
0