115222024-10-19 09:36:08DávidPontos Átlagcpp17Wrong answer 60/10097ms2592 KiB
#include <bits/stdc++.h>
#include <vector>
using namespace std;

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

	vector<int> arak(n);
	int 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
5Accepted1ms508 KiB
6Accepted1ms320 KiB
7Accepted1ms320 KiB
8Accepted1ms412 KiB
9Accepted1ms320 KiB
10Accepted1ms320 KiB
11Accepted1ms320 KiB
12Accepted1ms320 KiB
13Accepted1ms320 KiB
subtask340/40
14Accepted1ms320 KiB
15Accepted1ms320 KiB
16Accepted1ms320 KiB
17Accepted1ms568 KiB
18Accepted1ms320 KiB
19Accepted1ms320 KiB
20Accepted1ms320 KiB
21Accepted1ms320 KiB
22Accepted1ms408 KiB
23Accepted1ms412 KiB
24Accepted1ms560 KiB
25Accepted1ms320 KiB
26Accepted1ms320 KiB
subtask40/40
27Wrong answer93ms2344 KiB
28Partially correct94ms2348 KiB
29Wrong answer72ms2464 KiB
30Partially correct93ms2472 KiB
31Wrong answer94ms2340 KiB
32Partially correct97ms2472 KiB
33Wrong answer72ms2344 KiB
34Wrong answer94ms2360 KiB
35Partially correct94ms2360 KiB
36Wrong answer81ms2592 KiB
37Accepted93ms2344 KiB
38Accepted43ms1444 KiB
39Accepted90ms2360 KiB
40Accepted93ms2464 KiB
41Accepted70ms1844 KiB
42Accepted93ms2356 KiB
43Accepted64ms1848 KiB