답안 #949179

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
949179 2024-03-19T03:22:26 Z Sir_Ahmed_Imran Hacker (BOI15_hac) C++17
0 / 100
1 ms 604 KB
                              ///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define append push_back
#define add insert
#define nl "\n"
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define N 500001
int n;
int a[N];
int get(int l,int r){
    if(l>r)
        return a[n]-a[l-1]+a[r];
    return a[r]-a[l-1];
}
void solve(){
    int m,o,p,q;
    cin>>n;
    m=(n-1)/2;
    for(int i=o=1;i<=n;i++){
        cin>>a[i];
        a[i]+=a[i-1];
    }
    for(int i=1;i<=n;i++){
        if(i>m) p=i-m;
        else p=n-m+i;
        if(m+i<=n) q=i+m;
        else q=i+m-n;
        o=max(o,min(get(p,i),get(i,q)));
    }
    cout<<o;
}
int main(){
    L0TA;
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -