115242024-10-19 09:40:46DávidPontos Átlagcpp17Wrong answer 60/10093ms2104 KiB
#include <bits/stdc++.h>
#include <vector>
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;

	vector<long long> arak(n);
	long long osszeg = 0;

	for(int i = 0; i < n; i++) {
		cin >> arak[i];
		osszeg += arak[i];
	}

	if(osszeg < n * k) {
		cout << 1 << endl;
		return 0;
	}

	sort(arak.rbegin(), arak.rend());
	int eredmeny = 0;

	for(int i = 0; i < n; i++) {
		if(osszeg > n * k) {
			osszeg -= min(arak[i] - 1, osszeg - n * k);
			eredmeny++;
		}
	}

	cout << eredmeny << endl;
	
	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms320 KiB
2Accepted1ms320 KiB
subtask220/20
3Accepted1ms320 KiB
4Accepted1ms320 KiB
5Accepted1ms320 KiB
6Accepted1ms320 KiB
7Accepted1ms508 KiB
8Accepted1ms320 KiB
9Accepted1ms320 KiB
10Accepted1ms320 KiB
11Accepted1ms320 KiB
12Accepted1ms320 KiB
13Accepted1ms320 KiB
subtask340/40
14Accepted1ms320 KiB
15Accepted1ms320 KiB
16Accepted1ms320 KiB
17Accepted1ms320 KiB
18Accepted1ms412 KiB
19Accepted1ms392 KiB
20Accepted1ms320 KiB
21Accepted1ms320 KiB
22Accepted1ms320 KiB
23Accepted1ms320 KiB
24Accepted1ms408 KiB
25Accepted1ms500 KiB
26Accepted1ms320 KiB
subtask40/40
27Wrong answer92ms1980 KiB
28Partially correct93ms1980 KiB
29Partially correct92ms1984 KiB
30Partially correct92ms1972 KiB
31Partially correct92ms1848 KiB
32Partially correct92ms2104 KiB
33Partially correct93ms1848 KiB
34Partially correct93ms1848 KiB
35Partially correct93ms1848 KiB
36Accepted83ms1848 KiB
37Wrong answer92ms1980 KiB
38Accepted43ms1848 KiB
39Partially correct89ms1848 KiB
40Wrong answer90ms2036 KiB
41Partially correct68ms1976 KiB
42Wrong answer90ms2088 KiB
43Accepted63ms1848 KiB