結果

問題 No.8121 [Deleted]
ユーザー a01sa01to
提出日時 2025-09-04 00:07:22
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 3,010 ms
コンパイル使用メモリ 281,172 KB
実行使用メモリ 7,712 KB
最終ジャッジ日時 2025-09-04 00:07:29
合計ジャッジ時間 6,567 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

#include <atcoder/fenwicktree>

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  atcoder::fenwick_tree<ll> fw(n);
  rep(i, n) fw.add(i, a[i]);
  rep(_, q) {
    ll t, x, y;
    cin >> t >> x >> y;
    if (t == 1) {
      fw.add(x, y - a[x]);
      a[x] = y;
    }
    else {
      cout << fw.sum(x, y) << '\n';
    }
  }
  return 0;
}
0