結果

問題 No.1705 Mode of long array
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-10-08 23:06:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 400 ms / 3,000 ms
コード長 506 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 103,920 KB
最終ジャッジ日時 2023-09-30 12:33:24
合計ジャッジ時間 16,569 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,376 KB
testcase_01 AC 73 ms
71,376 KB
testcase_02 AC 76 ms
71,068 KB
testcase_03 AC 118 ms
77,920 KB
testcase_04 AC 113 ms
77,740 KB
testcase_05 AC 123 ms
78,928 KB
testcase_06 AC 147 ms
79,584 KB
testcase_07 AC 149 ms
79,348 KB
testcase_08 AC 152 ms
79,464 KB
testcase_09 AC 149 ms
79,084 KB
testcase_10 AC 147 ms
79,036 KB
testcase_11 AC 149 ms
80,660 KB
testcase_12 AC 153 ms
80,052 KB
testcase_13 AC 254 ms
94,696 KB
testcase_14 AC 224 ms
90,456 KB
testcase_15 AC 231 ms
90,584 KB
testcase_16 AC 251 ms
93,992 KB
testcase_17 AC 226 ms
90,404 KB
testcase_18 AC 208 ms
87,596 KB
testcase_19 AC 267 ms
94,900 KB
testcase_20 AC 219 ms
88,132 KB
testcase_21 AC 236 ms
92,456 KB
testcase_22 AC 272 ms
97,872 KB
testcase_23 AC 237 ms
93,064 KB
testcase_24 AC 244 ms
93,268 KB
testcase_25 AC 239 ms
93,084 KB
testcase_26 AC 242 ms
93,056 KB
testcase_27 AC 238 ms
92,896 KB
testcase_28 AC 233 ms
93,092 KB
testcase_29 AC 235 ms
93,172 KB
testcase_30 AC 236 ms
93,128 KB
testcase_31 AC 245 ms
94,608 KB
testcase_32 AC 243 ms
93,080 KB
testcase_33 AC 309 ms
103,432 KB
testcase_34 AC 310 ms
103,768 KB
testcase_35 AC 310 ms
101,860 KB
testcase_36 AC 311 ms
103,552 KB
testcase_37 AC 307 ms
102,440 KB
testcase_38 AC 307 ms
103,792 KB
testcase_39 AC 308 ms
103,908 KB
testcase_40 AC 308 ms
103,920 KB
testcase_41 AC 306 ms
103,820 KB
testcase_42 AC 310 ms
103,000 KB
testcase_43 AC 260 ms
94,816 KB
testcase_44 AC 262 ms
94,716 KB
testcase_45 AC 257 ms
94,720 KB
testcase_46 AC 255 ms
95,072 KB
testcase_47 AC 260 ms
94,952 KB
testcase_48 AC 265 ms
95,204 KB
testcase_49 AC 388 ms
101,008 KB
testcase_50 AC 382 ms
100,644 KB
testcase_51 AC 374 ms
100,816 KB
testcase_52 AC 400 ms
101,392 KB
testcase_53 AC 384 ms
100,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush

n,m = map(int,input().split())
A = list(map(int,input().split()))
num = [0]+A[:]
h = []
for i,a in enumerate(A):
    heappush(h,(-a,-i-1))

q = int(input())
Q = [list(map(int,input().split())) for i in range(q)]
for t,x,y in Q:
    if t == 1:
        num[x] += y
        heappush(h,(-num[x],-x))

    if t == 2:
        num[x] -= y
        heappush(h,(-num[x],-x))

    if t == 3:
        while num[-h[0][1]] != -h[0][0]:
            heappop(h)
        print(-h[0][1])
0