#pragma GCC optimize("O3,Ofast,unroll-loops")
#include "bits/stdc++.h"
const int MOD = 1e9 + 7;
using namespace std;
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define ll long long
#define S second
#define F first
void solve() {
int n, q, k;
cin >> n >> q >> k;
vi c(n);
for (int &i : c) cin >> i;
while (q--) {
int s, t, u;
cin >> s >> t >> u;
if (s == 1) {
c[t - 1] = u;
}
else if (s == 2) {
for (int i = t - 1; i < u; i++) {
c[i] /= k;
}
}
else {
ll sum = 0;
for (int i = t - 1; i < u; i++) {
sum += c[i];
}
cout << sum << endl;
}
}
}
int main() {
cin.tie(0)->sync_with_stdio(0);
int t = 1;
// cin >> t;
while (t--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
4 ms |
472 KB |
Output is correct |
5 |
Correct |
6 ms |
348 KB |
Output is correct |
6 |
Correct |
6 ms |
536 KB |
Output is correct |
7 |
Correct |
6 ms |
540 KB |
Output is correct |
8 |
Correct |
6 ms |
344 KB |
Output is correct |
9 |
Correct |
6 ms |
344 KB |
Output is correct |
10 |
Correct |
6 ms |
348 KB |
Output is correct |
11 |
Correct |
6 ms |
540 KB |
Output is correct |
12 |
Correct |
6 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3486 ms |
2928 KB |
Output is correct |
2 |
Correct |
2184 ms |
2520 KB |
Output is correct |
3 |
Correct |
3478 ms |
2936 KB |
Output is correct |
4 |
Execution timed out |
5060 ms |
3300 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
852 KB |
Output is correct |
2 |
Correct |
264 ms |
856 KB |
Output is correct |
3 |
Correct |
418 ms |
856 KB |
Output is correct |
4 |
Correct |
954 ms |
1688 KB |
Output is correct |
5 |
Correct |
3768 ms |
2276 KB |
Output is correct |
6 |
Correct |
3751 ms |
2256 KB |
Output is correct |
7 |
Correct |
3806 ms |
2668 KB |
Output is correct |
8 |
Correct |
3786 ms |
2776 KB |
Output is correct |
9 |
Execution timed out |
5021 ms |
1984 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1375 ms |
2284 KB |
Output is correct |
2 |
Correct |
1591 ms |
2900 KB |
Output is correct |
3 |
Correct |
853 ms |
1884 KB |
Output is correct |
4 |
Correct |
1201 ms |
2476 KB |
Output is correct |
5 |
Correct |
3783 ms |
3516 KB |
Output is correct |
6 |
Correct |
3812 ms |
3720 KB |
Output is correct |
7 |
Correct |
3802 ms |
3620 KB |
Output is correct |
8 |
Correct |
3765 ms |
3532 KB |
Output is correct |
9 |
Execution timed out |
5042 ms |
2696 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |