Submission #853530

# Submission time Handle Problem Language Result Execution time Memory
853530 2023-09-24T14:10:06 Z NK_ Hacker (BOI15_hac) C++17
0 / 100
1 ms 348 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
 
using namespace std;
 
#define nl '\n'
#define pb push_back
#define pf push_front
 
#define mp make_pair
#define f first
#define s second
#define sz(x) int(x.size())
 
template<class T> using V = vector<T>;
using pi = pair<int, int>;
using vi = V<int>;
using vpi = V<pi>;
 
using ll = long long;
using pl = pair<ll, ll>;
using vpl = V<pl>;
using vl = V<ll>;
 
using db = long double;
 
template<class T> using pq = priority_queue<T, V<T>, greater<T>>;
 
const int MOD = 1e9 + 7;
const ll INFL = ll(1e17);
const int LG = 18;

int main() {
	cin.tie(0)->sync_with_stdio(0);

	int N; cin >> N;
	vi A(N); for(auto& x : A) cin >> x;

	for(int i = 0; i < N; i++) A.pb(A[i]);

	vl P = {0}; for(int i = 0; i < 2*N; i++) P.pb(P.back() + A[i]);


	auto qry = [&](int l, int r) {
		return P[r+1] - P[l];
	};

	int M = (N + 1) / 2;

	ll ans = 0;
	for(int i = M-1; i+M-1 < 2*N; i++) ans = max(ans, min(qry(i-M+1, i), qry(i, i+M-1)));

	cout << ans << nl;

	exit(0-0);
} 	


# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -