Submission #203620

# Submission time Handle Problem Language Result Execution time Memory
203620 2020-02-21T15:54:10 Z mdn2002 Hacker (BOI15_hac) C++14
0 / 100
5 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
long long n,sum,a[1000500];
vector<long long>v;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    for(int i=n;i<2*n;i++)a[i]=a[i-n];
    long long sum1=a[0],l=0,r=0,mx=n/2;
    while(true)
    {
        if(r-l+1>mx)
        {
            sum1-=a[l];
            l++;
        }
        if(l==n)break;
        if(r-l+1==mx)v.push_back(sum-sum1);
        r++;
        sum1+=a[r];
    }
    sort(v.begin(),v.end());
    cout<<v[(v.size()/2)];
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -