Submission #787828

#TimeUsernameProblemLanguageResultExecution timeMemory
787828ThylOneAddk (eJOI21_addk)C++14
36 / 100
2062 ms3440 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...