#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, q, k; cin >> n >> q >> k;
vector <int> c(n + 1);
for ( int i = 1; i <= n; i++ ) cin >> c[i];
while ( q-- ){
int t, l, r; cin >> t >> l >> r;
if ( t == 1 ){
c[l] = r;
} else if ( t == 2 ){
for ( int i = l; i <= r; i++ ) c[i] /= k;
} else{
int cnt = 0;
for ( int i = l; i <= r; i++ ) cnt += c[i];
cout << cnt << '\n';
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |