Submission #723539

# Submission time Handle Problem Language Result Execution time Memory
723539 2023-04-14T04:45:57 Z Erkinoff_Mohammed Hacker (BOI15_hac) C++14
0 / 100
1 ms 212 KB
#include "bits/stdc++.h"
using namespace std;
#define INF 2000000000
#define INFLL 3000000000000000000LL
#define ll long long





int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n;
    cin>>n;
    int arr[n];
    int sum=0;
    int sum2=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        sum+=arr[i];
        if(i<(n+1)/2)sum2+=arr[i];
    }
    priority_queue<pair<int,int>>s;
    for(int i=0;i<n;i++){
        //cout<<sum-sum2*2<<" "<<sum2<<"\n";
        if(sum2>sum-sum2){
            s.push({sum-sum2*2,sum2});
        }
        sum2-=arr[i];
        sum2+=arr[(i+(n+1)/2)%n];
    }
    cout<<s.top().second;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -