Submission #1042778

#TimeUsernameProblemLanguageResultExecution timeMemory
1042778Alexe1900Addk (eJOI21_addk)C++14
0 / 100
165 ms3280 KiB
#include <bits/stdc++.h> using namespace std; signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); long long n, k; cin >> n >> k; vector<long long> prefixsums; prefixsums.push_back(0); for (long long i = 0; i < n; i++) { long long a; cin >> a; prefixsums.push_back(a + prefixsums[i]); } long long q; cin >> q; for (long long i = 0; i < n; i++) { long long a; cin >> a; if (a == 1) { for (long long j = 0; j < k; j++) { long long b; cin >> b; } } else { long long l, r, m, s=0; cin >> l >> r >> m; for (long long j = 0; j < min(m, (r-l+1)/2); j++) { s += prefixsums[r+1] - prefixsums[l+1]; l++; r--; } cout << s << "\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...