30102023-02-08 10:46:12bzsofiaKártyajátékcpp11Wrong answer 18/3048ms5248 KiB
// kartyajatek.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <deque>
#include <vector>
#include <algorithm>

using namespace std;

int i, n, m, db, pont;
deque <int> sorrend;

int main()
{
    cin >> m >> n;
    vector <int> kevert(n + 1);

    for (i = 1; i <= n; ++i)
    {
        cin >> kevert[i];
        sorrend.push_front(kevert[i]);
    }

    sort(sorrend.begin(), sorrend.end());

    for (i = 1; i <= n; ++i)
    {
        if (!sorrend.empty() && sorrend.front() <= kevert[i])
        {
            db = 0;
            while (sorrend.front() != kevert[i])
            {
                sorrend.pop_front();
                ++db;
            }
            sorrend.pop_front();

            if (db >= 1) ++pont;
        }
    }

    cout << pont;

    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base18/30
1Accepted0/03ms1808 KiB
2Wrong answer0/03ms2064 KiB
3Accepted1/13ms2428 KiB
4Accepted1/13ms2364 KiB
5Accepted1/13ms2560 KiB
6Accepted2/23ms2784 KiB
7Accepted2/23ms2868 KiB
8Accepted2/23ms3000 KiB
9Accepted1/134ms4156 KiB
10Accepted2/248ms4756 KiB
11Accepted3/348ms5224 KiB
12Accepted3/348ms5248 KiB
13Wrong answer0/13ms3964 KiB
14Wrong answer0/23ms3840 KiB
15Wrong answer0/33ms3840 KiB
16Wrong answer0/33ms3968 KiB
17Wrong answer0/33ms4048 KiB