#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
int main() {
ll n,q,k;
cin >> n >> q >> k;
ll a[n+2];
for(ll i = 1; i <= n; i++){
cin >> a[i];
}
while(q--){
ll s,x,y;
cin >> s >> x >> y;
if(s == 1){
a[x] = y;
}
if(s == 2){
for(ll i = x; i <= y; i++)a[i] /= k;
}
if(s == 3){
ll sum = 0;
for(ll i = x; i <= y; i++){
sum+=a[i];
}
cout << sum << '\n';
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
5 ms |
444 KB |
Output is correct |
5 |
Correct |
8 ms |
460 KB |
Output is correct |
6 |
Correct |
6 ms |
336 KB |
Output is correct |
7 |
Correct |
6 ms |
468 KB |
Output is correct |
8 |
Correct |
6 ms |
336 KB |
Output is correct |
9 |
Correct |
6 ms |
460 KB |
Output is correct |
10 |
Correct |
7 ms |
336 KB |
Output is correct |
11 |
Correct |
6 ms |
336 KB |
Output is correct |
12 |
Correct |
6 ms |
508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1191 ms |
1096 KB |
Output is correct |
2 |
Correct |
760 ms |
840 KB |
Output is correct |
3 |
Correct |
1167 ms |
1276 KB |
Output is correct |
4 |
Correct |
2455 ms |
1528 KB |
Output is correct |
5 |
Correct |
2433 ms |
1608 KB |
Output is correct |
6 |
Correct |
2440 ms |
1564 KB |
Output is correct |
7 |
Correct |
2424 ms |
1608 KB |
Output is correct |
8 |
Correct |
2424 ms |
1608 KB |
Output is correct |
9 |
Execution timed out |
5072 ms |
1464 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
126 ms |
336 KB |
Output is correct |
2 |
Correct |
172 ms |
784 KB |
Output is correct |
3 |
Correct |
295 ms |
772 KB |
Output is correct |
4 |
Correct |
628 ms |
616 KB |
Output is correct |
5 |
Correct |
2374 ms |
1240 KB |
Output is correct |
6 |
Correct |
2362 ms |
1216 KB |
Output is correct |
7 |
Correct |
2384 ms |
1320 KB |
Output is correct |
8 |
Correct |
2381 ms |
1104 KB |
Output is correct |
9 |
Execution timed out |
5053 ms |
1244 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
890 ms |
840 KB |
Output is correct |
2 |
Correct |
1037 ms |
1044 KB |
Output is correct |
3 |
Correct |
549 ms |
912 KB |
Output is correct |
4 |
Correct |
781 ms |
840 KB |
Output is correct |
5 |
Correct |
2385 ms |
1352 KB |
Output is correct |
6 |
Correct |
2411 ms |
1436 KB |
Output is correct |
7 |
Correct |
2431 ms |
1384 KB |
Output is correct |
8 |
Correct |
2389 ms |
1504 KB |
Output is correct |
9 |
Execution timed out |
5074 ms |
1212 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |