77782024-01-11 09:50:58ZsBalazsKártyajátékcpp17Accepted 30/30105ms7480 KiB
#include <bits/stdc++.h>

using namespace std;

int main() {
    long long n, k;
    cin >> n >> k;
    
    vector<long long> szamok;
    
    priority_queue<long long> sor;
    
    for (long long i = 0; k > i; i++) {
        long long szam;
        cin >> szam;
        
        szamok.push_back(szam);
        sor.push(szam * -1);
    }
    
    long long pontszam = 0;
    for (long long i = 0; k > i; i++) {
        bool good = false;
        
        while (!sor.empty()) {
            long long current = sor.top()*-1;
            
            if (current <= szamok[i]) {
                sor.pop();
            } else {
                break;
            }
            if (current < szamok[i]) {
                good = true;
            }
        }
        
        if (good) {
            pontszam++;
        }
    }
    
    cout << pontszam << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1812 KiB
2Accepted0/0104ms5356 KiB
3Accepted1/13ms2232 KiB
4Accepted1/13ms2444 KiB
5Accepted1/13ms2652 KiB
6Accepted2/23ms2888 KiB
7Accepted2/23ms2968 KiB
8Accepted2/23ms3084 KiB
9Accepted1/139ms6256 KiB
10Accepted2/256ms6396 KiB
11Accepted3/354ms6876 KiB
12Accepted3/357ms7084 KiB
13Accepted1/1105ms7284 KiB
14Accepted2/2105ms7344 KiB
15Accepted3/3104ms7344 KiB
16Accepted3/3105ms7380 KiB
17Accepted3/3104ms7480 KiB