# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
483531 |
2021-10-30T08:34:52 Z |
otogagnidze |
Addk (eJOI21_addk) |
C++14 |
|
234 ms |
6612 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];
}
int q;
cin >> q;
while(q--){
int h, l, r, m;
cin >> h;
if(h == 2){
cin >> l >> r >> 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 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
5 ms |
332 KB |
Output is correct |
4 |
Correct |
7 ms |
448 KB |
Output is correct |
5 |
Correct |
9 ms |
500 KB |
Output is correct |
6 |
Correct |
11 ms |
588 KB |
Output is correct |
7 |
Correct |
14 ms |
588 KB |
Output is correct |
8 |
Correct |
16 ms |
644 KB |
Output is correct |
9 |
Correct |
22 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
964 KB |
Output is correct |
2 |
Correct |
74 ms |
2028 KB |
Output is correct |
3 |
Correct |
91 ms |
2756 KB |
Output is correct |
4 |
Correct |
166 ms |
4604 KB |
Output is correct |
5 |
Correct |
234 ms |
6612 KB |
Output is correct |
6 |
Correct |
219 ms |
6324 KB |
Output is correct |
7 |
Correct |
211 ms |
6320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
136 ms |
1888 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |