#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, q, k;
cin >> n >> q >> k;
vector<int> a(n + 1);
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
while(q--) {
int o;
cin >> o;
if(o == 1) {
int index, value;
cin >> index >> value;
a[index] = value;
}
else if(o == 2) {
int l, r;
cin >> l >> r;
for(int i = l; i <= r; i++) {
a[i] /= k;
}
}
else {
int l, r;
cin >> l >> r;
int ans = 0;
for(int i = l; i <= r; i++) {
ans += a[i];
}
cout << ans << "\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... |