제출 #5882

#제출 시각아이디문제언어결과실행 시간메모리
5882baneling100전봇대 (KOI13_pole)C++98
0 / 100
32 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...