답안 #723629

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
723629 2023-04-14T06:34:13 Z MurotY Hacker (BOI15_hac) C++14
0 / 100
2 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 l=(n+1)/2, j=i;
		ll sum=0;
		while (l > 0){
			sum+=a[j];
			j=(j+1) % n;
			l--;
		}
		ll sum1=0;
		l=(n+1)/2, j=i;
		while (l > 0){
			sum1+=a[j];
			j=(j-1+n) % n;
			l--;
		}
		ans=max(ans, min(sum, sum1));
	}
	cout << ans;
	return ;
}
int main(){
	ios;
	int t=1;	
//	cin >> t;
	while (t--){ 
	    solve();
	    cout << "\n";
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 216 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 216 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 2 ms 340 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 216 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -