結果
問題 | No.1705 Mode of long array |
ユーザー |
|
提出日時 | 2021-10-08 23:06:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 374 ms / 3,000 ms |
コード長 | 506 bytes |
コンパイル時間 | 187 ms |
コンパイル使用メモリ | 81,964 KB |
実行使用メモリ | 102,972 KB |
最終ジャッジ日時 | 2024-07-23 06:35:56 |
合計ジャッジ時間 | 13,989 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
ソースコード
from heapq import heappop, heappushn,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] += yheappush(h,(-num[x],-x))if t == 2:num[x] -= yheappush(h,(-num[x],-x))if t == 3:while num[-h[0][1]] != -h[0][0]:heappop(h)print(-h[0][1])