Submission #86385

#TimeUsernameProblemLanguageResultExecution timeMemory
86385chunghan전봇대 (KOI13_pole)C++17
0 / 100
15 ms1236 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int lld; int N; lld B, C, D, L[100005]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> N; for (int i = 0; i < N; i++) cin >> L[i]; lld D = L[N-1]/(N-1); for (int i = 0; i < N; i++) { C += abs(L[i] - D*i); } D++; for (int i = 0; i < N; i++) { B += abs(L[i] - D*i); } cout << min(B, C); 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...