96952024-02-28 10:37:51norbertvidaKövek (100 pont)cpp11Accepted 100/10013ms6456 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long int lli;

int main() {
    iostream::sync_with_stdio(0);
    cin.tie(0);
    int N;
    cin >> N;
    vector<lli> K(N);
    lli sum = 0L;
    for(int i = 0; i < N; i++) {
        cin >> K[i];
        sum += K[i];
    }
    lli avg = sum / N;
    lli moves = 0L;
    for(int i = 0; i < N - 1; i++) {
        if(K[i] == avg) continue;
        K[i + 1] += K[i] - avg;
        moves++;
    }
    cout << moves << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base100/100
1Accepted0/03ms2100 KiB
2Accepted0/013ms3808 KiB
3Accepted5/53ms2912 KiB
4Accepted5/53ms2940 KiB
5Accepted5/53ms3148 KiB
6Accepted5/53ms3232 KiB
7Accepted5/53ms3324 KiB
8Accepted5/53ms3544 KiB
9Accepted7/73ms3628 KiB
10Accepted7/72ms3636 KiB
11Accepted8/83ms3772 KiB
12Accepted8/83ms3912 KiB
13Accepted8/83ms4296 KiB
14Accepted8/84ms4468 KiB
15Accepted8/86ms4672 KiB
16Accepted8/810ms5964 KiB
17Accepted8/812ms6456 KiB