# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472927 |
2021-09-14T14:53:03 Z |
fuad27 |
Addk (eJOI21_addk) |
C++17 |
|
2000 ms |
2300 KB |
#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main () {
int n, k;
cin >> n >> k;
int arr[n+1];
for(int i = 1;i<=n;i++) {
cin >> arr[i];
}
int q;
cin >> q;
while(q--) {
int k;
cin >> k;
if(k == 1) {
int d;
cin >> d;
}
else {
int ans = 0;
int l, r, m;
cin >> l >> r >> m;
m = min(r-l+2 - m, m);
for(int i = l;i<=r;i++) {
ans += min(min(i-l+1, r-i+1), m)*arr[i];
}
cout<<ans<<endl;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
4 ms |
204 KB |
Output is correct |
3 |
Correct |
14 ms |
344 KB |
Output is correct |
4 |
Correct |
24 ms |
400 KB |
Output is correct |
5 |
Correct |
30 ms |
332 KB |
Output is correct |
6 |
Correct |
42 ms |
456 KB |
Output is correct |
7 |
Correct |
56 ms |
484 KB |
Output is correct |
8 |
Correct |
74 ms |
432 KB |
Output is correct |
9 |
Correct |
136 ms |
580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
498 ms |
760 KB |
Output is correct |
2 |
Correct |
1034 ms |
1440 KB |
Output is correct |
3 |
Correct |
1794 ms |
2300 KB |
Output is correct |
4 |
Execution timed out |
2087 ms |
1792 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
993 ms |
1324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |