#include <bits/stdc++.h>
#define debug(x) ([&] { auto _x = x; cerr << __LINE__ << ": " << #x << " = " << _x << endl; return _x; }())
using namespace std;
using ll = long long;
int main() {
int n, q, K;
cin >> n >> q >> K;
int x[n];
for (int &xi: x) cin >> xi;
while (q--) {
int s, t, u;
cin >> s >> t >> u;
if (s == 1) x[t - 1] = u;
else if (s == 2) {
for (int i = t - 1; i <= u - 1; ++i) x[i] /= K;
} else {
ll ans = 0;
for (int i = t - 1; i <= u - 1; ++i) ans += x[i];
cout << ans << endl;
}
}
}
# | 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... |