Submission #626834

#TimeUsernameProblemLanguageResultExecution timeMemory
626834kkkkkkkkAddk (eJOI21_addk)C++14
36 / 100
2073 ms1344 KiB
#include <iostream> using namespace std; int main() { int n,k,q; cin >> n >> k; int a[n]; for (int i=0;i<n;i++) cin >> a[i]; cin >> q; int type,p,l,r,m; for (int i=0;i<q;i++) { cin >> type; if (type==1) { cin >> p; continue; } cin >> l >> r >> m; l--,r--; long long vk=0; for (int j=l;j<l+m;j++) vk+=a[j]; long long window_sum=vk; int left=l,right=l+m; while (right<=r) { window_sum+=a[right]-a[left]; vk+=window_sum; left++; right++; } cout << vk << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...