23222023-01-10 12:47:21rennRobotokcpp17Accepted 50/5037ms6260 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;
	pontok.resize(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/03ms1696 KiB
2Accepted0/032ms3720 KiB
3Accepted2/22ms2068 KiB
4Accepted2/22ms2292 KiB
5Accepted2/22ms2500 KiB
6Accepted2/23ms2640 KiB
7Accepted2/23ms2912 KiB
8Accepted2/23ms2932 KiB
9Accepted2/22ms2964 KiB
10Accepted2/23ms3044 KiB
11Accepted2/26ms3272 KiB
12Accepted2/219ms3812 KiB
13Accepted2/22ms2952 KiB
14Accepted2/232ms5528 KiB
15Accepted2/228ms5840 KiB
16Accepted2/237ms6044 KiB
17Accepted4/428ms5908 KiB
18Accepted6/629ms6160 KiB
19Accepted6/632ms6260 KiB
20Accepted6/627ms6208 KiB