Submission #101132

# Submission time Handle Problem Language Result Execution time Memory
101132 2019-03-16T19:56:48 Z Leonardo_Paes Hacker (BOI15_hac) C++11
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5+10;

int vet[maxn], sum[maxn];

int main(){

	int n, resp=-1;

	cin >> n;

	for(int i=1; i<=n; i++){
		cin >> vet[i];
		sum[i]=vet[i]+sum[i-1];
	}

	int k = n/2;

	if(n%2==1)k++;

	for(int i=1; i<=n; i++){
		int left, right;

		if(i>=k)left=sum[i] - sum[i-k];
		else left=sum[i] + sum[n] - sum[n-(k-i)];

		if(i+k-1<=n)right = sum[k+i-1] - sum[i-1];
		else{
			right = sum[n]-sum[i-1] + sum[k-(n-i+1)];
		} 

		int u = min(left, right);

		resp=max(resp, u);
	}

	cout << resp << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -