// IN THE NAME OF ALLAH
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define wall cerr << "------------------------------------" << endl
#define pb push_back
#define pob pop_back
#define F first
#define S second
#define all(x) x.begin() , x.end()
#define scan scanf
#define print printf
#define outs(x) print("%lld " , x)
#define out(x) print("%lld\n" , x)
#define in(x) scan("%lld" , &x)
#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll , ll> pll;
typedef pair<pii,int> piii;
typedef pair<pll , ll> plll;
const int N = 4e5+10;
const int K = 640+10;
const ll mod = 1e9+7;
const ll INF = 1e9+10;
const int P = 31;
const int lg = 25;
const int delta = 10289;
int a[N];
signed main()
{
fast;
int n , m , q;
cin >> n >> m >> q;
for(int i = 1 ; i <= n ; i++)
cin >> a[i];
while(m--) {
int t , l , r;
cin >> t >> l >> r;
if(t == 1)
a[l] = r;
else if(t == 2)
for(int i = l ; i <= r ; i++)
a[i] /= q;
else {
int s = 0;
for(int i = l ; i <= r ; i++)
s += a[i];
cout << s << "\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
4 ms |
340 KB |
Output is correct |
5 |
Correct |
6 ms |
348 KB |
Output is correct |
6 |
Correct |
7 ms |
408 KB |
Output is correct |
7 |
Correct |
6 ms |
436 KB |
Output is correct |
8 |
Correct |
6 ms |
340 KB |
Output is correct |
9 |
Correct |
7 ms |
340 KB |
Output is correct |
10 |
Correct |
7 ms |
340 KB |
Output is correct |
11 |
Correct |
6 ms |
348 KB |
Output is correct |
12 |
Correct |
6 ms |
472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3797 ms |
2076 KB |
Output is correct |
2 |
Correct |
2363 ms |
1240 KB |
Output is correct |
3 |
Correct |
3799 ms |
1624 KB |
Output is correct |
4 |
Execution timed out |
5019 ms |
1796 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
125 ms |
832 KB |
Output is correct |
2 |
Correct |
286 ms |
960 KB |
Output is correct |
3 |
Correct |
459 ms |
972 KB |
Output is correct |
4 |
Correct |
986 ms |
1928 KB |
Output is correct |
5 |
Correct |
4032 ms |
2784 KB |
Output is correct |
6 |
Correct |
3976 ms |
2632 KB |
Output is correct |
7 |
Correct |
4009 ms |
2008 KB |
Output is correct |
8 |
Correct |
4105 ms |
1540 KB |
Output is correct |
9 |
Execution timed out |
5031 ms |
1216 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1448 ms |
2584 KB |
Output is correct |
2 |
Correct |
1694 ms |
2804 KB |
Output is correct |
3 |
Correct |
899 ms |
2060 KB |
Output is correct |
4 |
Correct |
1270 ms |
2528 KB |
Output is correct |
5 |
Correct |
4067 ms |
3964 KB |
Output is correct |
6 |
Correct |
4077 ms |
3860 KB |
Output is correct |
7 |
Correct |
4130 ms |
3932 KB |
Output is correct |
8 |
Correct |
4064 ms |
3896 KB |
Output is correct |
9 |
Execution timed out |
5055 ms |
2956 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |