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(){
ios::sync_with_stdio(false);
cin.tie(0);
int n,q,k;cin>>n>>k;
vector<int> nums(n);
for(int i = 0;i<n;i++){
cin>>nums[i];
}
cin>>q;
for(int _ = 0 ; _ <q;_++){
int type;cin>>type;
if(type==1){
vector<int> rotates(k);
for(int i = 0;i<k;i++){
cin>>rotates[i];
}
}else{
int a,b,m;
cin>>a>>b>>m;
a--;
b--;
int ans = 0;
int sum=0;
for(int i = a ; i <a+m;i++){
sum+=nums[i];
}
ans+=sum;
for(int i = a+m ; i <= b;i++){
sum-=nums[i-m];
sum+=nums[i];
ans+=sum;
}
cout<<ans<<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... |