正文
增加 3 行删除 3 行
154 行未改动全部展开155156157158159160161162163164165166167168169170171172173174175176177178154 行未改动全部展开signed main() {ios::sync_with_stdio(0) ;cin.tie(0) ;cout.tie(0) ;cin >> n >> m ;for (int i = 1 ; i <= n ; i ++) {cin >> a[i] ;add(i , a[i]) ;}for (int i = 1 , opt , x , y ; i <= m ; i ++) {cin >> opt >> x >> y ;if (opt == 1) {add(x , y) ;}else {cout << query(y) - query(x - 1) << "\n" ;}}return 0 ;}```154 行未改动全部展开155156157158159160161162163164165166167168169170171172173174175176177178154 行未改动全部展开signed main() {ios::sync_with_stdio(0) ;cin.tie(0) ;cout.tie(0) ;cin >> n >> m ;for (int i = 1 ; i <= n ; i ++) {cin >> a[i] ;add(i , a[i]) ;}for (int i = 1 , opt , x , y ; i <= m ; i ++) {cin >> opt >> x >> y ;if (opt == 1) {add(x , y) ;}else {cout << query(y) - query(x - 1) << "\n" ;}}return 0 ;}```