27172023-01-19 12:49:03gontermarkKártyajátékcpp17Wrong answer 14/3089ms6160 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

bool comp(int i, int j)
{
    return(i>j);
}

int main()
{
    long long n;
    int k;
    cin >> n >> k;
    long long maxsz=0;
    long long szam;
    vector<long long> lerak;
    vector<long long> felre;
    for(int i=0;i<k;i++)
    {
        cin >> szam;
        if(szam<maxsz) felre.push_back(szam);
        else
        {
            lerak.push_back(szam);
            maxsz=szam;
        }
    }
    sort(felre.begin(),felre.begin()+felre.size(),comp);
    int db=0;
    for(int i=0;i<lerak.size();i++)
    {
        if(felre.back()<lerak[i])
        {
            db++;
            while(felre.size()>0 && felre.back()<lerak[i])
            {
                felre.pop_back();
            }
        }
    }
    cout << db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base14/30
1Accepted0/03ms1812 KiB
2Wrong answer0/085ms3844 KiB
3Runtime error0/12ms2300 KiB
4Accepted1/12ms2284 KiB
5Wrong answer0/12ms2308 KiB
6Accepted2/22ms2524 KiB
7Wrong answer0/23ms2728 KiB
8Accepted2/22ms2808 KiB
9Accepted1/132ms4144 KiB
10Accepted2/245ms5744 KiB
11Accepted3/341ms5540 KiB
12Accepted3/343ms4832 KiB
13Wrong answer0/189ms5224 KiB
14Wrong answer0/286ms5624 KiB
15Wrong answer0/382ms6160 KiB
16Wrong answer0/385ms4840 KiB
17Wrong answer0/385ms5492 KiB