Submission #887499

#TimeUsernameProblemLanguageResultExecution timeMemory
887499TK_LD0102Hacker (BOI15_hac)C++17
0 / 100
0 ms348 KiB
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
int main(){
	ll n; cin >> n;
	vector<ll> a(2 * n + 1);
	a[0] = 0;
	multiset<ll> d;
	ll S = (n + 1) / 2;
	for (ll i = 1; i <= n; i++){
		cin >> a[i]; a[n + i] = a[i];
	}
	for (ll i = 1; i <= 2 * n; i++) a[i] += a[i - 1];
	ll res = 0;
	vector<ll> c(n + 1, 0);
	for (ll i = 1; i <= 2 * n; i++){
		if (i + S - 1 <= 2 * n) d.insert(a[i + S - 1] - a[i - 1]);
		if (i > S) d.erase(d.find(a[i - 1] - a[i - 1 - S]));
		ll tempt = ((i - 1) % n) + 1;
		c[tempt] = min(c[tempt], *c.begin());
	}
	for (ll i = 1; i <= n; i++) res=max(res, c[i]);
	cout << res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...