This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n,k;
cin>>n>>k;
if(k==1){
int a[n+1];
for(int q=1;q<=n;q++){
cin>>a[q];
}
int u;
cin>>u;
while(u--){
int ans=0;
int sum=0;
int type,l,r,m;
cin>>type;
if(type==1){
int a;
cin>>a;
continue;
}
cin>>l>>r>>m;
int cnt=1;
for(int q=l;q<=r;q++){
if(cnt<=m){
sum+=a[q];
}
else{
ans+=sum;
sum-=a[q-m];
sum+=a[q];
}
cnt++;
//cout<<ans<<endl;
}
ans+=sum;
cout<<ans<<endl;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |