51342023-04-19 19:35:57anonKártyajátékcpp17Accepted 30/3035ms19736 KiB
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>

typedef long long ll;

using namespace std;

int main()
{
    ll i, ans, N, K;

    scanf("%lld %lld", &N, &K);

    vector<ll> hand(K);

    for(i = 0; i < K; i++)
        scanf("%lld", &hand[i]);

    vector<ll> table, points;

    for(i = 0; i < K; i++)
    {
        vector<ll>::iterator it = upper_bound(table.begin(), table.end(), hand[i]);

        if(it == table.end())
        {
            table.push_back(hand[i]);
            points.push_back(0);
        }
        else
            points[it - table.begin()] = 1;
    }

    ans = accumulate(points.begin(), points.end(), 0);

    printf("%lld\n", ans);

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1332 KiB
2Accepted0/035ms6640 KiB
3Accepted1/12ms3536 KiB
4Accepted1/13ms3664 KiB
5Accepted1/12ms3748 KiB
6Accepted2/23ms4040 KiB
7Accepted2/23ms4280 KiB
8Accepted2/23ms4292 KiB
9Accepted1/117ms6136 KiB
10Accepted2/227ms8928 KiB
11Accepted3/326ms10112 KiB
12Accepted3/326ms10444 KiB
13Accepted1/132ms10952 KiB
14Accepted2/235ms13556 KiB
15Accepted3/332ms17740 KiB
16Accepted3/334ms18004 KiB
17Accepted3/334ms19736 KiB