Submission #5883

#TimeUsernameProblemLanguageResultExecution timeMemory
5883baneling100전봇대 (KOI13_pole)C++98
0 / 100
24 ms2648 KiB
#include <stdio.h> #include <stdlib.h> #include <algorithm> using namespace std; long long N, x[100001], y[100001], Ans; void input(void) { int i; scanf("%lld %d",&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) { int i; long long 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...