Submission #5884

# Submission time Handle Problem Language Result Execution time Memory
5884 2014-05-21T07:46:52 Z baneling100 전봇대 (KOI13_pole) C++
0 / 100
28 ms 2648 KB
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;

long long N, x[100001], y[100001], Ans;

void input(void)
{
    long long i;

    scanf("%lld %lld",&N,&i);
    for(i=1 ; i<N ; i++)
    {
        scanf("%lld",&x[i]);
        y[i]=x[i]/i;
    }
    sort(y+1,y+N);
}

void process(void)
{
    long long i, temp=0;

    for(i=1 ; i<N ; i++)
    {
        Ans+=abs(x[i]-i*y[N/2]);
        temp+=abs(x[i]-i*(y[N/2]+1));
    }
    if(Ans>temp)
        Ans=temp;
}

void output(void)
{
    printf("%lld",Ans);
}

int main(void)
{
    input();
    process();
    output();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2648 KB Output is correct
2 Correct 0 ms 2648 KB Output is correct
3 Incorrect 0 ms 2648 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -