Submission #723636

# Submission time Handle Problem Language Result Execution time Memory
723636 2023-04-14T06:46:11 Z MurotY Hacker (BOI15_hac) C++14
20 / 100
1000 ms 340 KB
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2")
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz size()
using namespace std;
const double pi = 2 * acos(0.0);
const ll N=1e6+7, M=998244353;

ll a[N], pr[N];
void solve()
{
	int n;
	cin >> n;
	for (int i=0;i<n;i++) {
	     cin >> a[i];
		pr[i]=pr[max(0, i-1)]+a[i];
	}
	ll ans=0;
	for (int i=0;i<n;i++){
		int res=(n+1)/2;
		ll mn=1e18;
		for (int j=0;j<res;j++){
			
			int l=(i-1+n) % n;
			ll sum=0;
			for (int pos=0;pos<j;pos++){
				sum+=a[l];
				l=(l-1+n) % n;
			}
			l=i;
			for (int pos=0;pos<res-j;pos++){
				sum+=a[l];
				l=(l+1) % n;
			}
			mn=min(mn, sum);
		}
		ans=max(ans, mn);
	}
	cout << ans;
	return ;
}
int main(){
	ios;
	int t=1;	
//	cin >> t;
	while (t--){ 
	    solve();
	    cout << "\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 33 ms 252 KB Output is correct
8 Correct 32 ms 336 KB Output is correct
9 Correct 33 ms 212 KB Output is correct
10 Correct 34 ms 316 KB Output is correct
11 Correct 33 ms 212 KB Output is correct
12 Correct 33 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 32 ms 332 KB Output is correct
17 Correct 33 ms 324 KB Output is correct
18 Correct 32 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 33 ms 252 KB Output is correct
8 Correct 32 ms 336 KB Output is correct
9 Correct 33 ms 212 KB Output is correct
10 Correct 34 ms 316 KB Output is correct
11 Correct 33 ms 212 KB Output is correct
12 Correct 33 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 32 ms 332 KB Output is correct
17 Correct 33 ms 324 KB Output is correct
18 Correct 32 ms 212 KB Output is correct
19 Correct 147 ms 340 KB Output is correct
20 Execution timed out 1075 ms 340 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 77 ms 340 KB Output is correct
3 Execution timed out 1096 ms 340 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 33 ms 252 KB Output is correct
8 Correct 32 ms 336 KB Output is correct
9 Correct 33 ms 212 KB Output is correct
10 Correct 34 ms 316 KB Output is correct
11 Correct 33 ms 212 KB Output is correct
12 Correct 33 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 32 ms 332 KB Output is correct
17 Correct 33 ms 324 KB Output is correct
18 Correct 32 ms 212 KB Output is correct
19 Correct 147 ms 340 KB Output is correct
20 Execution timed out 1075 ms 340 KB Time limit exceeded
21 Halted 0 ms 0 KB -