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>
#define int long long
using namespace std;
signed main(){
int n,k;
cin>>n>>k;
int a[n+1];
for(int i=1;i<=n;i++)cin>>a[i];
int pref[n+1];
pref[0]=0;
for(int i=1;i<=n;i++)pref[i]=pref[i-1]+a[i];
int q;
cin>>q;
if(max(n,q)<=10000&&k==1){
while(q--){
int o;
cin>>o;
if(o==1){
int X;
cin>>X;
continue;
}
int l,r,m;
cin>>l>>r>>m;
int ans=0;
for(int i=l;i<=r;i++){
if(i+m-1>r)break;
ans+=pref[i+m-1]-pref[i-1];
}
cout<<ans;
cout<<endl;
}
return 0;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |