結果

問題 No.1705 Mode of long array
ユーザー mahiro72mahiro72
提出日時 2021-10-23 17:39:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 383 ms / 3,000 ms
コード長 510 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 103,204 KB
最終ジャッジ日時 2023-10-26 00:51:45
合計ジャッジ時間 19,704 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,492 KB
testcase_01 AC 40 ms
53,492 KB
testcase_02 AC 39 ms
53,492 KB
testcase_03 AC 90 ms
76,424 KB
testcase_04 AC 81 ms
74,512 KB
testcase_05 AC 92 ms
76,620 KB
testcase_06 AC 111 ms
76,812 KB
testcase_07 AC 122 ms
77,836 KB
testcase_08 AC 122 ms
77,960 KB
testcase_09 AC 117 ms
77,600 KB
testcase_10 AC 111 ms
77,568 KB
testcase_11 AC 118 ms
77,556 KB
testcase_12 AC 121 ms
78,096 KB
testcase_13 AC 236 ms
93,816 KB
testcase_14 AC 197 ms
89,256 KB
testcase_15 AC 210 ms
89,128 KB
testcase_16 AC 231 ms
92,260 KB
testcase_17 AC 199 ms
87,616 KB
testcase_18 AC 181 ms
85,764 KB
testcase_19 AC 249 ms
94,564 KB
testcase_20 AC 191 ms
87,724 KB
testcase_21 AC 213 ms
90,460 KB
testcase_22 AC 261 ms
97,020 KB
testcase_23 AC 217 ms
92,664 KB
testcase_24 AC 223 ms
92,656 KB
testcase_25 AC 222 ms
92,632 KB
testcase_26 AC 218 ms
92,664 KB
testcase_27 AC 221 ms
92,664 KB
testcase_28 AC 230 ms
92,668 KB
testcase_29 AC 224 ms
92,664 KB
testcase_30 AC 225 ms
92,664 KB
testcase_31 AC 224 ms
92,660 KB
testcase_32 AC 223 ms
92,664 KB
testcase_33 AC 299 ms
103,204 KB
testcase_34 AC 292 ms
102,932 KB
testcase_35 AC 294 ms
102,032 KB
testcase_36 AC 295 ms
102,928 KB
testcase_37 AC 298 ms
102,048 KB
testcase_38 AC 293 ms
102,940 KB
testcase_39 AC 292 ms
102,944 KB
testcase_40 AC 296 ms
103,020 KB
testcase_41 AC 297 ms
102,928 KB
testcase_42 AC 294 ms
102,032 KB
testcase_43 AC 244 ms
93,968 KB
testcase_44 AC 245 ms
93,996 KB
testcase_45 AC 248 ms
94,000 KB
testcase_46 AC 244 ms
94,008 KB
testcase_47 AC 250 ms
94,072 KB
testcase_48 AC 250 ms
94,060 KB
testcase_49 AC 370 ms
100,652 KB
testcase_50 AC 366 ms
100,156 KB
testcase_51 AC 364 ms
100,120 KB
testcase_52 AC 383 ms
100,468 KB
testcase_53 AC 369 ms
100,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop,heappush

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

hq = []
for i,a in enumerate(A):
    heappush(hq,(-a,-i-1))
num = [0]+A[:]


q = int(input())
Q = [tuple(map(int,input().split()))for _ in range(q)]
for t,x,y in Q:
    if t==1:
        num[x]+=y
        heappush(hq,(-num[x],-x))
    elif t==2:
        num[x]-=y
        heappush(hq,(-num[x],-x))
    else:
        while num[-hq[0][1]]!=-hq[0][0]:
            heappop(hq)
        print(-hq[0][1])

0