結果

問題 No.1705 Mode of long array
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-06-03 16:17:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 334 ms / 3,000 ms
コード長 873 bytes
コンパイル時間 1,159 ms
コンパイル使用メモリ 113,572 KB
実行使用メモリ 10,388 KB
最終ジャッジ日時 2023-08-28 07:59:15
合計ジャッジ時間 16,044 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 10 ms
4,380 KB
testcase_07 AC 13 ms
4,376 KB
testcase_08 AC 12 ms
4,380 KB
testcase_09 AC 11 ms
4,376 KB
testcase_10 AC 11 ms
4,376 KB
testcase_11 AC 11 ms
4,380 KB
testcase_12 AC 11 ms
4,376 KB
testcase_13 AC 244 ms
8,700 KB
testcase_14 AC 156 ms
6,204 KB
testcase_15 AC 143 ms
4,380 KB
testcase_16 AC 172 ms
4,412 KB
testcase_17 AC 115 ms
4,380 KB
testcase_18 AC 100 ms
4,380 KB
testcase_19 AC 211 ms
5,260 KB
testcase_20 AC 122 ms
4,872 KB
testcase_21 AC 177 ms
7,844 KB
testcase_22 AC 282 ms
9,312 KB
testcase_23 AC 108 ms
4,380 KB
testcase_24 AC 109 ms
4,380 KB
testcase_25 AC 109 ms
4,380 KB
testcase_26 AC 108 ms
4,376 KB
testcase_27 AC 109 ms
4,376 KB
testcase_28 AC 108 ms
4,380 KB
testcase_29 AC 107 ms
4,380 KB
testcase_30 AC 108 ms
4,376 KB
testcase_31 AC 107 ms
4,376 KB
testcase_32 AC 108 ms
4,376 KB
testcase_33 AC 330 ms
10,076 KB
testcase_34 AC 334 ms
10,072 KB
testcase_35 AC 316 ms
10,132 KB
testcase_36 AC 308 ms
10,072 KB
testcase_37 AC 304 ms
10,216 KB
testcase_38 AC 319 ms
10,388 KB
testcase_39 AC 311 ms
10,108 KB
testcase_40 AC 310 ms
10,224 KB
testcase_41 AC 315 ms
10,164 KB
testcase_42 AC 304 ms
10,224 KB
testcase_43 AC 259 ms
10,276 KB
testcase_44 AC 261 ms
10,384 KB
testcase_45 AC 257 ms
10,292 KB
testcase_46 AC 262 ms
10,292 KB
testcase_47 AC 259 ms
10,368 KB
testcase_48 AC 262 ms
10,284 KB
testcase_49 AC 252 ms
10,208 KB
testcase_50 AC 249 ms
10,152 KB
testcase_51 AC 244 ms
10,224 KB
testcase_52 AC 250 ms
10,068 KB
testcase_53 AC 246 ms
10,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    ll N, M, Q, t, x, y;
    cin >> N >> M;
    vector<ll> cnt(M+1);
    multiset<pair<ll, ll>> st;
    for (int i=1; i<=M; i++) cin >> cnt[i];

    for (int i=1; i<=M; i++) st.insert({cnt[i], i});
    cin >> Q;
    while(Q){
        Q--;
        cin >> t >> x >> y;
        if (t == 1){
            st.erase({cnt[x], x});
            cnt[x] += y;
            st.insert({cnt[x], x});
        }
        else if (t == 2){
            st.erase({cnt[x], x});
            cnt[x] -= y;
            st.insert({cnt[x], x});
        }
        else cout << st.rbegin()->second << endl;
    }

    return 0;
}
0