#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q, k;
cin >> n >> q >> k;
vector<int> a(n + 1);
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
while(q--) {
int o;
cin >> o;
if(o == 1) {
int l, r;
cin >> l >> r;
a[l] = r;
}
else if(o == 2) {
int l, r;
cin >> l >> r;
for(int i = l; i <= r; i++) {
a[i] /= k;
}
}
else {
int l, r;
cin >> l >> r;
int ans = 0;
for(int i = l; i <= r; i++) {
ans += a[i];
}
cout << ans << "\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
5 |
Correct |
5 ms |
348 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
6 ms |
348 KB |
Output is correct |
8 |
Correct |
5 ms |
560 KB |
Output is correct |
9 |
Correct |
5 ms |
348 KB |
Output is correct |
10 |
Correct |
6 ms |
344 KB |
Output is correct |
11 |
Correct |
5 ms |
548 KB |
Output is correct |
12 |
Correct |
5 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3553 ms |
3236 KB |
Output is correct |
2 |
Correct |
2210 ms |
2908 KB |
Output is correct |
3 |
Correct |
3558 ms |
2900 KB |
Output is correct |
4 |
Execution timed out |
5028 ms |
3672 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
112 ms |
852 KB |
Output is correct |
2 |
Correct |
279 ms |
856 KB |
Output is correct |
3 |
Correct |
435 ms |
1184 KB |
Output is correct |
4 |
Correct |
958 ms |
1656 KB |
Output is correct |
5 |
Correct |
3960 ms |
2920 KB |
Output is correct |
6 |
Correct |
3929 ms |
3044 KB |
Output is correct |
7 |
Correct |
4017 ms |
2628 KB |
Output is correct |
8 |
Correct |
3986 ms |
2672 KB |
Output is correct |
9 |
Execution timed out |
5041 ms |
1996 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1425 ms |
2564 KB |
Output is correct |
2 |
Correct |
1661 ms |
2756 KB |
Output is correct |
3 |
Correct |
884 ms |
2196 KB |
Output is correct |
4 |
Correct |
1216 ms |
2728 KB |
Output is correct |
5 |
Correct |
3971 ms |
4444 KB |
Output is correct |
6 |
Correct |
3989 ms |
4400 KB |
Output is correct |
7 |
Correct |
4005 ms |
3836 KB |
Output is correct |
8 |
Correct |
3938 ms |
4024 KB |
Output is correct |
9 |
Execution timed out |
5040 ms |
2796 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |