74992024-01-09 11:17:59almadavKártyajátékcpp17Accepted 30/3035ms8464 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    iostream::sync_with_stdio(0);
    cin.tie(0);
    unsigned long long n,k;
    int pont =0;
    cin >> n;
    cin >> k;
    bool igen;
    vector<unsigned long long> alma;
    unsigned long long current;
    for(int i =0; i<k;i++)
    {
        cin >> current; alma.push_back(current);
    }

    vector<unsigned long long>alma2=alma;
    sort(alma2.begin(), alma2.end());
    alma2.push_back(n+1);
    int j =0;
    /*for(unsigned long long x: alma)
    {
        cout << x <<" ";
    }
    cout <<endl;
    for(unsigned long long x: alma2)
    {
        cout << x <<" ";
    }
    cout <<endl;*/
    for(int i =0; i <k;i++)
    {
        igen = true;
        while(alma2[j]<=alma[i])
        {
            if(alma2[j]!=alma[i] && igen) pont++;
            igen=false;
            j++;
        }
    }
    cout << pont;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1860 KiB
2Accepted0/035ms6856 KiB
3Accepted1/13ms2296 KiB
4Accepted1/13ms2512 KiB
5Accepted1/13ms2668 KiB
6Accepted2/23ms3036 KiB
7Accepted2/23ms3244 KiB
8Accepted2/23ms3200 KiB
9Accepted1/118ms6808 KiB
10Accepted2/226ms8256 KiB
11Accepted3/325ms8464 KiB
12Accepted3/326ms8420 KiB
13Accepted1/135ms8424 KiB
14Accepted2/235ms8440 KiB
15Accepted3/335ms8420 KiB
16Accepted3/335ms8420 KiB
17Accepted3/335ms8452 KiB