Submission #86385

# Submission time Handle Problem Language Result Execution time Memory
86385 2018-11-26T08:36:11 Z chunghan 전봇대 (KOI13_pole) C++17
0 / 100
15 ms 1236 KB
#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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Incorrect 2 ms 564 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 1236 KB Output isn't correct
2 Halted 0 ms 0 KB -