////////////////////////////////////////////////
// //
// 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;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
380 KB |
Output is correct |
2 |
Correct |
6 ms |
380 KB |
Output is correct |
3 |
Correct |
5 ms |
584 KB |
Output is correct |
4 |
Correct |
14 ms |
812 KB |
Output is correct |
5 |
Correct |
20 ms |
812 KB |
Output is correct |
6 |
Correct |
19 ms |
812 KB |
Output is correct |
7 |
Correct |
18 ms |
908 KB |
Output is correct |
8 |
Correct |
23 ms |
980 KB |
Output is correct |
9 |
Correct |
19 ms |
1088 KB |
Output is correct |
10 |
Correct |
19 ms |
1156 KB |
Output is correct |
11 |
Correct |
24 ms |
1236 KB |
Output is correct |
12 |
Correct |
19 ms |
1236 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
1416 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
1548 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
1548 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |