Submission #1038390

#TimeUsernameProblemLanguageResultExecution timeMemory
1038390tarpentAddk (eJOI21_addk)C++14
92 / 100
993 ms5196 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long const ll maxn = 1e5+7; ll n,k,q,tre,tz,l,r,m; ll pre[maxn]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>k; for(ll i = 0; i<n; i++){ cin>>tre; pre[i+1]=pre[i]+tre; } cin>>q; for(ll i = 0;i<q; i++){ cin>>tre; if(tre==1){ cin>>l; } else{ cin>>l>>r>>m; ll od = 0; int f = min(m,(r-l+1)-m+1); for(ll p = 0; p<f; p++){ od+=pre[r]-pre[l-1]; r--; l++; } cout<<od<<'\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...