16752022-12-01 15:33:22sarminKövek (100 pont)cpp17Wrong answer 0/10026ms4840 KiB
#include <bits/stdc++.h>
using namespace std;

void getVector(vector<int>& v) {
	for (int i = 0; i < (int) v.size(); i++) {
		cerr << v[i] << " ";
	}
	cerr << "\n";
}

int main() {

	int N;
	cin >> N;
	vector<int> K(N);
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> K[i];
		sum += K[i];
	}

	int allWill = sum / N, valami = 0;
	for (int i = 0; i < N-1; i++) {
		if (K[i] <= K[i+1] && K[i] != allWill) {
			K[i+1] -= allWill-K[i];
			K[i] = allWill;
		} else {
			K[i+1] += K[i]-allWill;
			K[i] = allWill;
		}
		valami++;
	}
	cout << valami-1;

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/100
1Accepted0/03ms2092 KiB
2Wrong answer0/026ms2844 KiB
3Wrong answer0/52ms2356 KiB
4Wrong answer0/52ms2560 KiB
5Wrong answer0/52ms2760 KiB
6Wrong answer0/52ms3016 KiB
7Wrong answer0/52ms3088 KiB
8Wrong answer0/52ms3276 KiB
9Wrong answer0/72ms3344 KiB
10Wrong answer0/72ms3472 KiB
11Wrong answer0/82ms3680 KiB
12Wrong answer0/82ms3884 KiB
13Wrong answer0/83ms3948 KiB
14Wrong answer0/84ms3972 KiB
15Wrong answer0/810ms4116 KiB
16Wrong answer0/823ms4392 KiB
17Wrong answer0/826ms4840 KiB