This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
////////////////////////////////////////////////
// //
// Author: Muhammad Faishol Amirul Mukminin //
// //
////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N, Q, K;
ll data[3005];
int main(){
cin >> N >> Q >> K;
for(int i=1;i<=N;i++) cin >> data[i];
while(Q--){
int id;
ll a, b;
cin >> id >> a >> b;
if(id == 1){
data[a] = b;
}else if(id == 2){
for(int i=a; i<=b;i++) data[i] /= K;
}else{
ll ans = 0;
for(int i=a;i<=b;i++) ans += data[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... |