結果

問題 No.1705 Mode of long array
ユーザー ripityripity
提出日時 2022-11-02 12:12:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 229 ms / 3,000 ms
コード長 777 bytes
コンパイル時間 5,670 ms
コンパイル使用メモリ 261,040 KB
実行使用メモリ 8,920 KB
最終ジャッジ日時 2023-09-23 19:12:43
合計ジャッジ時間 20,839 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 3 ms
4,384 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 9 ms
4,376 KB
testcase_07 AC 11 ms
4,376 KB
testcase_08 AC 11 ms
4,380 KB
testcase_09 AC 10 ms
4,376 KB
testcase_10 AC 9 ms
4,376 KB
testcase_11 AC 10 ms
4,380 KB
testcase_12 AC 9 ms
4,380 KB
testcase_13 AC 138 ms
8,292 KB
testcase_14 AC 104 ms
5,716 KB
testcase_15 AC 108 ms
4,376 KB
testcase_16 AC 128 ms
4,380 KB
testcase_17 AC 92 ms
4,376 KB
testcase_18 AC 74 ms
4,380 KB
testcase_19 AC 140 ms
4,768 KB
testcase_20 AC 85 ms
4,432 KB
testcase_21 AC 109 ms
8,292 KB
testcase_22 AC 163 ms
8,584 KB
testcase_23 AC 85 ms
4,376 KB
testcase_24 AC 85 ms
4,380 KB
testcase_25 AC 86 ms
4,384 KB
testcase_26 AC 89 ms
4,376 KB
testcase_27 AC 85 ms
4,380 KB
testcase_28 AC 84 ms
4,376 KB
testcase_29 AC 84 ms
4,376 KB
testcase_30 AC 86 ms
4,376 KB
testcase_31 AC 85 ms
4,380 KB
testcase_32 AC 89 ms
4,380 KB
testcase_33 AC 152 ms
8,856 KB
testcase_34 AC 155 ms
8,828 KB
testcase_35 AC 154 ms
8,756 KB
testcase_36 AC 154 ms
8,804 KB
testcase_37 AC 155 ms
8,852 KB
testcase_38 AC 155 ms
8,804 KB
testcase_39 AC 154 ms
8,868 KB
testcase_40 AC 154 ms
8,836 KB
testcase_41 AC 153 ms
8,764 KB
testcase_42 AC 152 ms
8,768 KB
testcase_43 AC 227 ms
8,816 KB
testcase_44 AC 229 ms
8,804 KB
testcase_45 AC 226 ms
8,824 KB
testcase_46 AC 226 ms
8,828 KB
testcase_47 AC 226 ms
8,756 KB
testcase_48 AC 228 ms
8,920 KB
testcase_49 AC 225 ms
8,908 KB
testcase_50 AC 214 ms
8,908 KB
testcase_51 AC 167 ms
8,816 KB
testcase_52 AC 170 ms
8,760 KB
testcase_53 AC 170 ms
8,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
struct S {
  long long mx;
  int argmx;
};
S op(S l, S r) {
  if( l.mx > r.mx ) return l;
  else return r;
}
S e() {
  return S{0, 0};
}
int main() {
  long long N;
  int M;
  cin >> N >> M;
  vector<S> A(M);
  for( int i = 0; i < M; i++ ) {
    long long val;
    cin >> val;
    A[i] = S{val, i};
  }
  int Q;
  cin >> Q;
  segtree<S, op, e> st(A);
  for( int q = 0; q < Q; q++ ) {
    int T, X;
    long long Y;
    cin >> T >> X >> Y;
    X--;
    if( T == 1 ) {
      S s = st.get(X);
      st.set(X, S{s.mx+Y, X});
    }else if( T == 2 ) {
      S s = st.get(X);
      st.set(X, S{s.mx-Y, X});
    }else {
      S s = st.all_prod();
      cout << s.argmx+1 << endl;
    }
  }
}
0