16802022-12-01 15:38:49sarminKövek (100 pont)cpp17Time limit exceeded 15/100300ms3724 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] == 6 || K[i+1] == 6) continue;
		if (K[i] < K[i+1] && K[i] != allWill) {
			K[i+1] -= allWill-K[i];
			K[i] = allWill;
			getVector(K);
		} else {
			K[i+1] += K[i]-allWill;
			K[i] = allWill;
			getVector(K);
		}
		valami++;
	}
	cout << valami;

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/100
1Accepted0/03ms1684 KiB
2Time limit exceeded0/0300ms1448 KiB
3Wrong answer0/52ms2052 KiB
4Wrong answer0/52ms2256 KiB
5Accepted5/52ms2456 KiB
6Accepted5/53ms2664 KiB
7Accepted5/52ms2740 KiB
8Wrong answer0/52ms2748 KiB
9Wrong answer0/72ms2872 KiB
10Wrong answer0/721ms3084 KiB
11Wrong answer0/8160ms3152 KiB
12Time limit exceeded0/8239ms2612 KiB
13Time limit exceeded0/8266ms2820 KiB
14Time limit exceeded0/8259ms3724 KiB
15Time limit exceeded0/8282ms3252 KiB
16Time limit exceeded0/8275ms3524 KiB
17Time limit exceeded0/8266ms3616 KiB