/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
#define int long long
int Tree[3000000];
int N=(1<<(int)(log2(1000000)));
signed main()
{
int n,k,q;
cin>>n>>q>>k;
int arr[n+1];
for(int i=0;i<n;i++){
cin>>arr[i];
Tree[i+N]=arr[i];
}
if(n<=3000&&q<=3000){
while(q--){
int type;
cin>>type;
if(type==1){
int indx,b;
cin>>indx>>b;
arr[indx-1]=b;
}
if(type==2){
int l,r;
cin>>l>>r;
for(int i=l-1;i<r;i++){
arr[i]=arr[i]/k;
}
}
if(type==3){
int l,r,sum=0;
cin>>l>>r;
for(int i=l-1;i<r;i++){
sum+=arr[i];
}
cout<<sum<<endl;
}
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2396 KB |
Output is correct |
2 |
Correct |
4 ms |
2396 KB |
Output is correct |
3 |
Correct |
2 ms |
2396 KB |
Output is correct |
4 |
Correct |
5 ms |
2564 KB |
Output is correct |
5 |
Correct |
8 ms |
2396 KB |
Output is correct |
6 |
Correct |
8 ms |
2396 KB |
Output is correct |
7 |
Correct |
9 ms |
2396 KB |
Output is correct |
8 |
Correct |
8 ms |
2396 KB |
Output is correct |
9 |
Correct |
8 ms |
2588 KB |
Output is correct |
10 |
Correct |
8 ms |
2396 KB |
Output is correct |
11 |
Correct |
8 ms |
2396 KB |
Output is correct |
12 |
Correct |
8 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
5468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
5468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |