# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
483529 |
2021-10-30T08:33:47 Z |
otogagnidze |
Addk (eJOI21_addk) |
C++14 |
|
133 ms |
1932 KB |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, k;
cin >> n >> k;
long long a[n + 1], b[n + 1], b2[n + 1];
b[0] = 0; b2[0] = 0;
for(int i = 1; i <= n; i++){
cin >> a[i];
b[i] = b[i - 1] + a[i];
b2[i] = b2[i - 1] + b[i];
}
/*for(int i = 1; i <= n; i++){
cout << b[i] << " ";
}
cout << endl;
for(int i = 1; i <= n; i++){
cout << b2[i] << " ";
}
*/
int q;
cin >> q;
while(q--){
int h, l, r, m;
cin >> h;
if(h == 2){
cin >> l >> r >> m;
m = min((r - l + 1) / 2, m);
long long ans = b2[r] - b2[r - m] - b2[l + m - 2];
if(l - 2 > 0)
ans += b2[l - 2];
cout << ans << endl;
}
else{
int d;
for(int i = 1; i <= k; i++)
cin >> d;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
1004 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
133 ms |
1932 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |