結果

問題 No.1705 Mode of long array
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-13 13:49:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 241 ms / 3,000 ms
コード長 810 bytes
コンパイル時間 2,842 ms
コンパイル使用メモリ 202,768 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2024-04-13 13:49:31
合計ジャッジ時間 11,542 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 3 ms
6,940 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 5 ms
6,940 KB
testcase_07 AC 6 ms
6,944 KB
testcase_08 AC 6 ms
6,940 KB
testcase_09 AC 5 ms
6,944 KB
testcase_10 AC 5 ms
6,940 KB
testcase_11 AC 6 ms
6,944 KB
testcase_12 AC 5 ms
6,940 KB
testcase_13 AC 132 ms
8,960 KB
testcase_14 AC 77 ms
6,944 KB
testcase_15 AC 53 ms
6,940 KB
testcase_16 AC 80 ms
6,940 KB
testcase_17 AC 47 ms
6,940 KB
testcase_18 AC 41 ms
6,944 KB
testcase_19 AC 97 ms
6,944 KB
testcase_20 AC 56 ms
6,940 KB
testcase_21 AC 102 ms
7,936 KB
testcase_22 AC 166 ms
9,728 KB
testcase_23 AC 55 ms
6,940 KB
testcase_24 AC 54 ms
6,944 KB
testcase_25 AC 54 ms
6,940 KB
testcase_26 AC 53 ms
6,944 KB
testcase_27 AC 55 ms
6,940 KB
testcase_28 AC 54 ms
6,940 KB
testcase_29 AC 54 ms
6,940 KB
testcase_30 AC 54 ms
6,940 KB
testcase_31 AC 57 ms
6,940 KB
testcase_32 AC 58 ms
6,944 KB
testcase_33 AC 237 ms
10,240 KB
testcase_34 AC 208 ms
10,112 KB
testcase_35 AC 207 ms
10,368 KB
testcase_36 AC 207 ms
10,240 KB
testcase_37 AC 217 ms
10,240 KB
testcase_38 AC 237 ms
10,240 KB
testcase_39 AC 241 ms
10,240 KB
testcase_40 AC 219 ms
10,240 KB
testcase_41 AC 220 ms
10,112 KB
testcase_42 AC 212 ms
10,112 KB
testcase_43 AC 73 ms
10,240 KB
testcase_44 AC 73 ms
10,240 KB
testcase_45 AC 73 ms
10,240 KB
testcase_46 AC 74 ms
10,112 KB
testcase_47 AC 73 ms
10,240 KB
testcase_48 AC 73 ms
10,368 KB
testcase_49 AC 133 ms
10,240 KB
testcase_50 AC 136 ms
10,112 KB
testcase_51 AC 129 ms
10,240 KB
testcase_52 AC 131 ms
10,240 KB
testcase_53 AC 128 ms
10,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    fast_io();
    long long n, m;
    cin >> n >> m;
    vector<long long> a(m);
    set<pair<long long, int>> st;
    for (int i = 0; i < m; i++) {
        cin >> a[i];
        st.insert({a[i], i});
    }
    int q;
    cin >> q;
    for (; q--;) {
        int t, x;
        long long y;
        cin >> t >> x >> y;
        x--;
        if (t == 1) {
            st.erase({a[x], x});
            a[x] += y;
            st.insert({a[x], x});
        }
        if (t == 2) {
            st.erase({a[x], x});
            a[x] -= y;
            st.insert({a[x], x});
        }
        if (t == 3) {
            cout << (*st.rbegin()).second + 1 << "\n";
        }
    }
}
0