23182023-01-10 12:43:39rennRobotokcpp11Accepted 50/5037ms6384 KiB
#include <bits/stdc++.h>
using namespace std;

#define InTheNameOfGod cin.tie(0); ios::sync_with_stdio(0);

typedef pair<int, int> pii;

int main()
{
    InTheNameOfGod

    int sor, oszlop, pont;
    cin >> sor >> oszlop >> pont;

    vector<pii> pontok(pont);
    //read all the coordinations at once
    for(auto &it : pontok)
        cin >> it.first >> it.second;
    sort(pontok.begin(), pontok.end());

    vector<int> indulok;
    indulok.resize(pont);
    int lis_len = 0;
    for(auto akt : pontok) {
        int idx = lower_bound(indulok.begin(), indulok.begin() + lis_len, -akt.second) - indulok.begin();
        indulok[idx] = -akt.second;
        if(idx == lis_len)
            lis_len++;
    }
    cout << lis_len;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1828 KiB
2Accepted0/032ms3912 KiB
3Accepted2/22ms2260 KiB
4Accepted2/22ms2424 KiB
5Accepted2/22ms2504 KiB
6Accepted2/23ms2696 KiB
7Accepted2/23ms2912 KiB
8Accepted2/23ms2836 KiB
9Accepted2/22ms2832 KiB
10Accepted2/23ms2960 KiB
11Accepted2/26ms3472 KiB
12Accepted2/218ms4272 KiB
13Accepted2/22ms3416 KiB
14Accepted2/232ms5844 KiB
15Accepted2/228ms5952 KiB
16Accepted2/237ms5876 KiB
17Accepted4/428ms6188 KiB
18Accepted6/628ms6248 KiB
19Accepted6/630ms6136 KiB
20Accepted6/626ms6384 KiB