177302025-09-16 18:33:18algoproPontos Átlagcpp17Wrong answer 0/1001.1s2036 KiB
// UUID: ad04922a-a624-4a94-a4a6-225658370aad
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    int atlag;

    cin >> N;
    cin >> atlag;

    vector<int>szamok(N);
    vector<int>szortirozott(N);

    int osszeg1 = 0;
    int osszeg2 = N*atlag;

    int temp;
    
    for(int i = 0; i< N; i++){
        cin >> temp;
        szamok[i] = temp;
        osszeg1 += temp;
    }       
    int maximum=0;
    for (int i1=0; i1<N; i1++) {
        for (int i2=0; i2<N; i2++){
            if (szamok[i2]<maximum) {
                maximum=szamok[i2];
                szamok[i2]=0;
            }
        }
        szortirozott[i1]=maximum;
    }  

    if (osszeg1 < osszeg2){
        cout<<1;
    }
    else if(osszeg1 == osszeg2){
        cout<<0;
    }
    else{
        int signed kulombseg=osszeg1-osszeg2;
        int vegso_osszeg=1;

        maximum=0;
        for (int i1=0; i1<N; i1++) {
            for (int i2=0; i2<N; i2++){
                if (szamok[i2]<maximum) {
                    maximum=szamok[i2];
                    szamok[i2]=0;
                }
            }
            szortirozott[i1]=maximum;
        } 
        
        for (int i=0; i==1;) {
            kulombseg-=szortirozott[i];
            if (kulombseg<1) {
                i=1;
            }
            else {
                vegso_osszeg++;
            }
        }
        cout << vegso_osszeg;
    }
} 
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms316 KiB
2Accepted1ms316 KiB
subtask20/20
3Accepted1ms316 KiB
4Accepted1ms368 KiB
5Accepted1ms316 KiB
6Accepted1ms316 KiB
7Accepted1ms316 KiB
8Wrong answer1ms316 KiB
9Accepted1ms316 KiB
10Accepted1ms380 KiB
11Wrong answer1ms392 KiB
12Wrong answer1ms316 KiB
13Accepted1ms316 KiB
subtask30/40
14Accepted3ms316 KiB
15Wrong answer4ms316 KiB
16Accepted4ms316 KiB
17Wrong answer4ms316 KiB
18Wrong answer4ms408 KiB
19Wrong answer4ms316 KiB
20Wrong answer4ms316 KiB
21Accepted3ms316 KiB
22Accepted4ms408 KiB
23Wrong answer4ms404 KiB
24Accepted4ms532 KiB
25Wrong answer4ms500 KiB
26Accepted4ms316 KiB
subtask40/40
27Time limit exceeded1.1s1844 KiB
28Time limit exceeded1.1s1784 KiB
29Time limit exceeded1.1s1844 KiB
30Time limit exceeded1.1s1844 KiB
31Time limit exceeded1.09s1856 KiB
32Time limit exceeded1.09s1852 KiB
33Time limit exceeded1.09s1844 KiB
34Time limit exceeded1.09s1844 KiB
35Time limit exceeded1.088s2036 KiB
36Time limit exceeded1.088s1844 KiB
37Time limit exceeded1.088s1844 KiB
38Time limit exceeded1.088s1844 KiB
39Time limit exceeded1.08s1844 KiB
40Time limit exceeded1.08s1792 KiB
41Time limit exceeded1.08s1844 KiB
42Time limit exceeded1.08s2036 KiB
43Time limit exceeded1.077s2036 KiB