結果

問題 No.1705 Mode of long array
ユーザー 👑 hitonanodehitonanode
提出日時 2021-10-08 23:18:10
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 225 ms / 3,000 ms
コード長 713 bytes
コンパイル時間 912 ms
コンパイル使用メモリ 98,252 KB
実行使用メモリ 10,376 KB
最終ジャッジ日時 2023-09-30 13:10:23
合計ジャッジ時間 8,974 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 5 ms
4,376 KB
testcase_07 AC 6 ms
4,380 KB
testcase_08 AC 6 ms
4,376 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 5 ms
4,380 KB
testcase_11 AC 5 ms
4,376 KB
testcase_12 AC 5 ms
4,380 KB
testcase_13 AC 135 ms
8,660 KB
testcase_14 AC 83 ms
6,264 KB
testcase_15 AC 55 ms
4,376 KB
testcase_16 AC 71 ms
4,524 KB
testcase_17 AC 48 ms
4,392 KB
testcase_18 AC 40 ms
4,384 KB
testcase_19 AC 95 ms
5,536 KB
testcase_20 AC 57 ms
4,876 KB
testcase_21 AC 100 ms
7,764 KB
testcase_22 AC 165 ms
9,636 KB
testcase_23 AC 52 ms
4,376 KB
testcase_24 AC 52 ms
4,380 KB
testcase_25 AC 51 ms
4,380 KB
testcase_26 AC 51 ms
4,376 KB
testcase_27 AC 51 ms
4,380 KB
testcase_28 AC 52 ms
4,376 KB
testcase_29 AC 52 ms
4,376 KB
testcase_30 AC 51 ms
4,376 KB
testcase_31 AC 52 ms
4,376 KB
testcase_32 AC 52 ms
4,380 KB
testcase_33 AC 208 ms
10,140 KB
testcase_34 AC 212 ms
10,048 KB
testcase_35 AC 210 ms
10,244 KB
testcase_36 AC 211 ms
10,144 KB
testcase_37 AC 214 ms
10,128 KB
testcase_38 AC 216 ms
10,376 KB
testcase_39 AC 225 ms
10,244 KB
testcase_40 AC 223 ms
10,204 KB
testcase_41 AC 212 ms
10,052 KB
testcase_42 AC 212 ms
10,112 KB
testcase_43 AC 91 ms
10,052 KB
testcase_44 AC 92 ms
10,244 KB
testcase_45 AC 92 ms
10,128 KB
testcase_46 AC 91 ms
10,200 KB
testcase_47 AC 92 ms
10,124 KB
testcase_48 AC 92 ms
10,048 KB
testcase_49 AC 136 ms
10,200 KB
testcase_50 AC 141 ms
10,072 KB
testcase_51 AC 136 ms
10,244 KB
testcase_52 AC 136 ms
10,072 KB
testcase_53 AC 133 ms
10,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
#include <utility>
#include <vector>
using namespace std;

int main() {
    cin.tie(nullptr), ios::sync_with_stdio(false);
    long long N;
    int M;
    cin >> N >> M;

    set<pair<long long, int>> se;
    vector<long long> A(M + 1);
    for (int i = 1; i <= M; ++i) {
        long long a;
        cin >> a;
        A[i] = a;
        se.emplace(a, i);
    }
    int Q;
    cin >> Q;
    while (Q--) {
        int t, x;
        long long y;
        cin >> t >> x >> y;
        se.erase(make_pair(A[x], x));
        if (t == 1) A[x] += y;
        if (t == 2) A[x] -= y;
        se.insert(make_pair(A[x], x));
        if (t == 3) cout << prev(se.end())->second << '\n';
    }
}
0