#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";
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
70 ms |
1516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
165 ms |
3280 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |