ログイン
新規登録
Summer Camp Problems Selection
Permanent Contest
Home
Tasks
Clar
Submissions
Standings
提出 fd510ec2-2f9d-4acb-956f-3e77ac1ff23c
コード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; int main() { int n; cin >> n; fenwick_tree<int> fw(n); rep(i, n) { int t; cin >> t; fw.add(i, t); } int q; cin >> q; for (int i = 0; i < q; i++) { int t; cin >> t; if (t == 1) { int p, x; cin >> p >> x; --p; fw.add(p, x - fw.sum(p, p+1)); } else { int l, r; cin >> l >> r; cout << fw.sum(--l, --r) << endl; } } }
結果
問題
点数
言語
結果
実行時間
メモリ
SegTree - segment tree
0
C++
WJ
0 ms
0 KiB
コンパイルエラー
Main.cpp: In function 'int main()': Main.cpp:8:9: error: 'i' was not declared in this scope 8 | rep(i, n) { | ^ Main.cpp:8:5: error: 'rep' was not declared in this scope 8 | rep(i, n) { | ^~~