17252022-12-01 19:32:35sarminKövek (100 pont)cpp17Wrong answer 27/10027ms4048 KiB
#include <bits/stdc++.h>
using namespace std;

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] == allWill || K[i+1] == allWill) continue;
		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;

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base27/100
1Accepted0/03ms1812 KiB
2Wrong answer0/027ms2760 KiB
3Accepted5/52ms2256 KiB
4Accepted5/52ms2504 KiB
5Wrong answer0/52ms2712 KiB
6Wrong answer0/52ms2744 KiB
7Accepted5/52ms2860 KiB
8Accepted5/52ms2900 KiB
9Accepted7/72ms2756 KiB
10Wrong answer0/72ms2756 KiB
11Wrong answer0/82ms2756 KiB
12Wrong answer0/82ms2880 KiB
13Wrong answer0/83ms3096 KiB
14Wrong answer0/84ms3108 KiB
15Wrong answer0/89ms3256 KiB
16Wrong answer0/823ms3636 KiB
17Wrong answer0/826ms4048 KiB