#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5+10;
int vet[MAXN], pref[MAXN];
int main(){
int n, k, resp=0x3f3f3f3f;
cin >> n;
k = ceil((double)n/2);
for(int i=1; i<=n; i++){
cin >> vet[i];
pref[i]=vet[i]+pref[i-1];
}
for(int i=1; i<=k; i++){
int sum=0;
sum+= pref[i];
sum+= pref[n] - pref[n-(k-i)];
resp=min(resp,sum);
}
cout << resp << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
24 ms |
996 KB |
Output is correct |
5 |
Correct |
48 ms |
2680 KB |
Output is correct |
6 |
Correct |
73 ms |
3448 KB |
Output is correct |
7 |
Correct |
91 ms |
3948 KB |
Output is correct |
8 |
Correct |
138 ms |
5544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |