67082023-12-17 18:10:55MagyarKendeSZLGPontos Átlagcpp17Wrong answer 0/10046ms6376 KiB
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, K, sum;
    cin >> N >> K;
    
    vector<int> P(N);
    for (int i = 0; i < N; i++) {
        cin >> P[i];
        sum += P[i];
    }
    sort(P.begin(), P.end());
    
    const int prod = N * K;
    
    if (prod == sum) {
        cout << 0 << endl;
    } else if (prod > sum) {
        cout << 1 << endl;
    } else {
        for (int i = N - 1, result = 0; i >= 0; i--) {
            sum -= P[i] - 1;
            result++;
            if (prod >= sum) {
                cout << result << endl;
                return 0;
            }
        }
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1860 KiB
2Accepted3ms2004 KiB
subtask20/20
3Accepted3ms2124 KiB
4Accepted3ms2328 KiB
5Wrong answer3ms2688 KiB
6Accepted3ms2628 KiB
7Accepted3ms2624 KiB
8Accepted3ms2760 KiB
9Accepted3ms2968 KiB
10Wrong answer3ms3180 KiB
11Accepted3ms3408 KiB
12Accepted3ms3504 KiB
13Wrong answer3ms3492 KiB
subtask30/40
14Accepted3ms3608 KiB
15Accepted3ms3712 KiB
16Accepted3ms3824 KiB
17Accepted3ms3908 KiB
18Accepted3ms3904 KiB
19Accepted3ms3908 KiB
20Wrong answer3ms3904 KiB
21Wrong answer3ms3904 KiB
22Accepted3ms4272 KiB
23Accepted3ms4172 KiB
24Wrong answer3ms4260 KiB
25Accepted3ms4256 KiB
26Wrong answer3ms4264 KiB
subtask40/40
27Wrong answer46ms5596 KiB
28Partially correct46ms5744 KiB
29Wrong answer46ms5652 KiB
30Partially correct46ms5868 KiB
31Partially correct46ms6056 KiB
32Partially correct46ms6304 KiB
33Wrong answer46ms6376 KiB
34Partially correct46ms6368 KiB
35Partially correct46ms6256 KiB
36Wrong answer30ms6256 KiB
37Wrong answer46ms6204 KiB
38Accepted23ms6280 KiB
39Accepted46ms6136 KiB
40Wrong answer45ms6132 KiB
41Accepted35ms6200 KiB
42Wrong answer46ms6196 KiB
43Wrong answer34ms6204 KiB