# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
629381 |
2022-08-14T12:44:06 Z |
polys |
Addk (eJOI21_addk) |
C++14 |
|
917 ms |
952 KB |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,j;
cin>>n>>j;
int A[n];
for(int k=0;k<n;k++){
cin>>A[k];
}
int q;
cin>>q;
int a;
int l,r,m;
for(int k=0;k<q;k++){
cin>>a;
if(a==1){
cin>>a;
}
else{
cin>>l>>r>>m;
l--;
r--;
int index=1;
int sum=0;
for(int k=l;k<((l+r+1)/2);k++){
sum+=A[k]*index;
index++;
if(index>=m){
index=m;
}
}
if((r-l)%2==0){
index--;
}
index=1;
for(int k=r;k>=((l+r+1)/2);k--){
sum+=A[k]*index;
index++;
if(index>=m){
index=m;
}
}
cout<<sum<<endl;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
462 ms |
528 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
917 ms |
952 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |