15802022-11-28 08:21:19sarminKövek (100 pont)cpp17Time limit exceeded 27/100256ms3236 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; i++) {
		for (int j = 0; j < N; j++) {
			if (K[i] != K[N-i] && (K[i] != allWill || K[j] != allWill)) {
				if (K[i] < allWill && K[j] > allWill) {
					valami++;
					K[j] = allWill-K[i];
					K[i] = allWill;
				} else if (K[j] < allWill && K[i] > allWill) {
					valami++;
					K[i] = allWill-K[j];
					K[j] = allWill;
				}
			}
		}
	}

	cout << valami << "\n";

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base27/100
1Accepted0/03ms1812 KiB
2Time limit exceeded0/0224ms1728 KiB
3Accepted5/52ms2268 KiB
4Accepted5/52ms2312 KiB
5Wrong answer0/52ms2384 KiB
6Wrong answer0/52ms2512 KiB
7Accepted5/52ms2592 KiB
8Accepted5/52ms2592 KiB
9Accepted7/72ms2712 KiB
10Wrong answer0/72ms2920 KiB
11Wrong answer0/82ms2992 KiB
12Wrong answer0/82ms3120 KiB
13Wrong answer0/812ms3212 KiB
14Wrong answer0/8101ms3236 KiB
15Time limit exceeded0/8234ms2684 KiB
16Time limit exceeded0/8256ms3084 KiB
17Time limit exceeded0/8256ms3148 KiB