#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define eb emplace_back
#define ll long long 
#define fi first
#define se second
int t,n,i,m,k;
const int maxn = 2e6 + 10;
ll a[maxn],mx;
ll get(int l,int r)
{
  return a[r] - a[l-1];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    // freopen("CHONSO.INP","r",stdin);
    // freopen("CHONSO.OUT","w",stdout);
    
    cin>>n;
    
    for(i = 1;i<=n;i++)
    {
      cin>>a[i];
      a[i+n] = a[i];
      a[i+n+n] = a[i];
    }
    for(i = 1;i<=n + n + n;i++)
    {
      a[i] += a[i-1];
    }
    
    m = (n + 1)/2;
    
    for(i = n + 1;i<=n + n;i++)
    {
      mx = max(mx,min(get(i,i + m - 1),get(i - m + 1,i)));
    }
    cout<<mx;
    
    
    return 0;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |