Submission #1035238

#TimeUsernameProblemLanguageResultExecution timeMemory
1035238makanhuliaAddk (eJOI21_addk)C++17
36 / 100
2068 ms3560 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...