67072023-12-17 18:08:38MagyarKendeSZLGPontos Átlagcpp17Wrong answer 0/10052ms5492 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;
    } else if (prod > sum) {
        cout << 1;
    } else {
        for (int i = N - 1, result = 0; i >= 0; i--) {
            sum -= P[i] - 1;
            result++;
            if (prod >= sum) {
                cout << result;
            }
        }
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1832 KiB
2Wrong answer3ms2032 KiB
subtask20/20
3Accepted3ms2396 KiB
4Wrong answer3ms2448 KiB
5Wrong answer3ms2552 KiB
6Accepted3ms2636 KiB
7Accepted3ms2748 KiB
8Wrong answer3ms2852 KiB
9Wrong answer3ms2952 KiB
10Wrong answer3ms3060 KiB
11Wrong answer3ms3152 KiB
12Wrong answer3ms3376 KiB
13Accepted3ms3416 KiB
subtask30/40
14Accepted3ms3508 KiB
15Wrong answer3ms3632 KiB
16Accepted3ms3708 KiB
17Wrong answer3ms3704 KiB
18Wrong answer3ms3708 KiB
19Wrong answer3ms3940 KiB
20Wrong answer3ms3924 KiB
21Wrong answer3ms3916 KiB
22Accepted3ms3916 KiB
23Wrong answer3ms4016 KiB
24Accepted3ms4256 KiB
25Wrong answer3ms4236 KiB
26Wrong answer3ms4100 KiB
subtask40/40
27Wrong answer52ms5492 KiB
28Wrong answer52ms5432 KiB
29Wrong answer46ms5364 KiB
30Wrong answer46ms5248 KiB
31Wrong answer50ms5312 KiB
32Wrong answer50ms5316 KiB
33Wrong answer48ms5324 KiB
34Wrong answer48ms5324 KiB
35Wrong answer46ms5484 KiB
36Wrong answer39ms5424 KiB
37Wrong answer48ms5396 KiB
38Wrong answer23ms5372 KiB
39Wrong answer52ms5436 KiB
40Wrong answer52ms5448 KiB
41Wrong answer35ms5248 KiB
42Accepted46ms5252 KiB
43Wrong answer34ms5252 KiB