結果

問題 No.1705 Mode of long array
ユーザー tabae326tabae326
提出日時 2021-10-08 23:12:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 3,000 ms
コード長 1,519 bytes
コンパイル時間 2,049 ms
コンパイル使用メモリ 204,240 KB
実行使用メモリ 8,948 KB
最終ジャッジ日時 2023-09-30 12:55:35
合計ジャッジ時間 6,870 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 5 ms
4,376 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 48 ms
8,556 KB
testcase_14 AC 34 ms
5,936 KB
testcase_15 AC 34 ms
4,380 KB
testcase_16 AC 40 ms
4,376 KB
testcase_17 AC 29 ms
4,380 KB
testcase_18 AC 25 ms
4,376 KB
testcase_19 AC 46 ms
4,760 KB
testcase_20 AC 28 ms
4,376 KB
testcase_21 AC 37 ms
8,268 KB
testcase_22 AC 54 ms
8,516 KB
testcase_23 AC 36 ms
4,380 KB
testcase_24 AC 35 ms
4,376 KB
testcase_25 AC 35 ms
4,376 KB
testcase_26 AC 35 ms
4,376 KB
testcase_27 AC 35 ms
4,380 KB
testcase_28 AC 36 ms
4,376 KB
testcase_29 AC 35 ms
4,376 KB
testcase_30 AC 35 ms
4,376 KB
testcase_31 AC 36 ms
4,380 KB
testcase_32 AC 35 ms
4,376 KB
testcase_33 AC 63 ms
8,772 KB
testcase_34 AC 63 ms
8,792 KB
testcase_35 AC 63 ms
8,792 KB
testcase_36 AC 63 ms
8,684 KB
testcase_37 AC 64 ms
8,656 KB
testcase_38 AC 65 ms
8,784 KB
testcase_39 AC 63 ms
8,908 KB
testcase_40 AC 62 ms
8,836 KB
testcase_41 AC 63 ms
8,860 KB
testcase_42 AC 63 ms
8,744 KB
testcase_43 AC 44 ms
8,800 KB
testcase_44 AC 43 ms
8,916 KB
testcase_45 AC 43 ms
8,820 KB
testcase_46 AC 43 ms
8,948 KB
testcase_47 AC 43 ms
8,792 KB
testcase_48 AC 43 ms
8,852 KB
testcase_49 AC 60 ms
8,792 KB
testcase_50 AC 59 ms
8,724 KB
testcase_51 AC 60 ms
8,736 KB
testcase_52 AC 60 ms
8,792 KB
testcase_53 AC 60 ms
8,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
// Ref: https://qiita.com/ysuzuki19/items/d89057d65284ba1a16ac
#define dump(var)  do{std::cerr << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cerr << e << "\n";}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cerr << e << " "; } std::cerr << "\n";}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ std::cerr << "\n"; for(const auto& v : vv){ view(v); } }
template<typename T> void dump_cout(const T& v) { for(long long i = 0; i < v.size(); i++) std::cout << v[i] << (i == v.size()-1 ? "\n" : " "); }

#include <atcoder/segtree>
using namespace atcoder;
using S = pair<ll, ll>;
S op(S a, S b) { return max(a, b); }
S e() { return {0, 0}; }

void solve() {
    ll n, m;
    cin >> n >> m;
    vector<S> a(m);
    rep(i, 0, m) {
        cin >> a[i].first;
        a[i].second = i+1;
    }    
    segtree<S, op, e> seg(a);
    ll q;
    cin >> q;
    while(q--) {
        ll t, x, y;
        cin >> t >> x >> y;
        x--;
        if(t == 1) {
            seg.set(x, {seg.get(x).first + y, x+1});
        }
        if(t == 2) {
            seg.set(x, {seg.get(x).first - y, x+1});
        }   
        if(t == 3) {
            cout << seg.all_prod().second << "\n";
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}
0