# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
483526 |
2021-10-30T08:26:29 Z |
otogagnidze |
Addk (eJOI21_addk) |
C++14 |
|
127 ms |
3012 KB |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, k;
cin >> n >> k;
int 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);
int 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 |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
1084 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
127 ms |
3012 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |