#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 |
4 ms |
456 KB |
Output is correct |
5 |
Correct |
6 ms |
460 KB |
Output is correct |
6 |
Correct |
6 ms |
336 KB |
Output is correct |
7 |
Correct |
6 ms |
456 KB |
Output is correct |
8 |
Correct |
6 ms |
504 KB |
Output is correct |
9 |
Correct |
6 ms |
336 KB |
Output is correct |
10 |
Correct |
6 ms |
336 KB |
Output is correct |
11 |
Correct |
6 ms |
464 KB |
Output is correct |
12 |
Correct |
6 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1172 ms |
1096 KB |
Output is correct |
2 |
Correct |
762 ms |
1096 KB |
Output is correct |
3 |
Correct |
1162 ms |
1100 KB |
Output is correct |
4 |
Correct |
1873 ms |
1512 KB |
Output is correct |
5 |
Correct |
2386 ms |
1608 KB |
Output is correct |
6 |
Correct |
2396 ms |
1604 KB |
Output is correct |
7 |
Correct |
2372 ms |
1696 KB |
Output is correct |
8 |
Correct |
2384 ms |
1676 KB |
Output is correct |
9 |
Execution timed out |
5060 ms |
1468 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
98 ms |
336 KB |
Output is correct |
2 |
Correct |
171 ms |
780 KB |
Output is correct |
3 |
Correct |
268 ms |
592 KB |
Output is correct |
4 |
Correct |
625 ms |
592 KB |
Output is correct |
5 |
Correct |
2382 ms |
1104 KB |
Output is correct |
6 |
Correct |
2346 ms |
1264 KB |
Output is correct |
7 |
Correct |
3019 ms |
1248 KB |
Output is correct |
8 |
Correct |
2424 ms |
1488 KB |
Output is correct |
9 |
Execution timed out |
5059 ms |
1236 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
905 ms |
948 KB |
Output is correct |
2 |
Correct |
1029 ms |
840 KB |
Output is correct |
3 |
Correct |
553 ms |
840 KB |
Output is correct |
4 |
Correct |
805 ms |
840 KB |
Output is correct |
5 |
Correct |
2428 ms |
1452 KB |
Output is correct |
6 |
Correct |
2468 ms |
1480 KB |
Output is correct |
7 |
Correct |
2450 ms |
1400 KB |
Output is correct |
8 |
Correct |
2389 ms |
1456 KB |
Output is correct |
9 |
Execution timed out |
5041 ms |
1376 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |