Submission #1036028

#TimeUsernameProblemLanguageResultExecution timeMemory
1036028christinelynnAddk (eJOI21_addk)C++17
36 / 100
2021 ms4392 KiB
#include <bits/stdc++.h> #define nikah ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long const ll maxn = 1e5+7; using namespace std; ll n,q,k; ll a[maxn], pref[maxn]; int main() { nikah cin>>n>>k; for (ll i=1; i<=n; i++) { cin>>a[i]; pref[i] = a[i] + pref[i-1]; } cin>>q; while (q--) { ll mode; cin>>mode; if (mode == 2) { ll l,r,m; cin>>l>>r>>m; ll ans = 0, re = l + m - 1; while (re <= r) { ans += (pref[re] - pref[l-1]); l++; re++; } cout<<ans<<endl; } else { ll x; cin>>x; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...