792021-01-10 12:16:34Csizmadia MiklósRobotokcpp11Runtime error 20/50112ms50992 KiB
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

bool volte [100000];

int main()
{
    int N;
    int M;
    int K;

    cin>>N>>M>>K;

    vector< pair<int,int> > sor;

    for (int i = 0; i < K;i++)
    {
        int a;
        int b;
        cin>>a>>b;
        sor.push_back({b,a});
    }

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

    int megoldas = 0;

    vector< pair<int,int> > sorok [100000];
    sorok[0]=sor;

    pair<int,int> elozo;
    elozo={0,0};

    for (int i = 0;sorok[i].size()>0;i++)
    {
        megoldas++;
        elozo = {0,0};
        for (int j = 0;j<sorok[i].size();j++)
        {
            if (sorok[i][j].first>=elozo.first && sorok[i][j].second>=elozo.second)
            {
                elozo = sorok[i][j];
            }
            else
            {
                sorok[i+1].push_back(sorok[i][j]);
            }
        }
        sorok[i].clear();
    }
    cout<<megoldas;


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base20/50
1Accepted0/04ms6396 KiB
2Runtime error0/092ms42288 KiB
3Accepted2/23ms7648 KiB
4Accepted2/23ms7484 KiB
5Accepted2/23ms7480 KiB
6Accepted2/27ms9152 KiB
7Accepted2/26ms9708 KiB
8Accepted2/24ms7524 KiB
9Accepted2/24ms7536 KiB
10Accepted2/24ms7640 KiB
11Accepted2/221ms19036 KiB
12Runtime error0/264ms46424 KiB
13Accepted2/24ms8160 KiB
14Runtime error0/2112ms49220 KiB
15Runtime error0/296ms50928 KiB
16Runtime error0/2108ms49200 KiB
17Runtime error0/490ms50992 KiB
18Runtime error0/696ms50952 KiB
19Runtime error0/698ms49212 KiB
20Runtime error0/698ms49220 KiB