25262023-01-16 10:39:14AbbenceKártyajátékcpp17Wrong answer 13/30136ms4772 KiB
#include <iostream>
#include <vector>
#include <algorithm>

/*
OKTV 2022 II. forduló
*/

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int hand[k];
    for(int i=0; i<k; i++){
        cin >> hand[i];
    }
    vector<int> played;
    played.push_back(hand[0]);
    for(int i=1; i<k; i++){
        if(hand[i] > played.back()){
            played.push_back(hand[i]);
        }
    }

    sort(hand,hand+k);

    int points = 0;

    int interval_max = 1;
    bool wasPointInInterval = false;
    for(int i=1; i<k; i++){
        if(hand[i] != played.at(interval_max)){
            if(!wasPointInInterval){
                points++;
                cerr << hand[i] << endl;
                wasPointInInterval = true;
            }
        }
        else{
            interval_max++;
            wasPointInInterval = false;
        }
    }

    cout << points << endl;

    return 0;
}
/*
25 7
1 8 3 15 4 20 16


1 3 4 8 15 16 20
*/
SubtaskSumTestVerdictTimeMemory
base13/30
1Accepted0/03ms1812 KiB
2Wrong answer0/02ms2032 KiB
3Accepted1/12ms2288 KiB
4Accepted1/12ms2488 KiB
5Accepted1/12ms2728 KiB
6Wrong answer0/23ms2884 KiB
7Accepted2/23ms3088 KiB
8Wrong answer0/23ms3076 KiB
9Wrong answer0/141ms3740 KiB
10Accepted2/2136ms4648 KiB
11Accepted3/3133ms4772 KiB
12Accepted3/3123ms4652 KiB
13Wrong answer0/12ms3420 KiB
14Wrong answer0/22ms3404 KiB
15Wrong answer0/32ms3336 KiB
16Wrong answer0/32ms3468 KiB
17Wrong answer0/32ms3688 KiB