23202023-01-10 12:46:51rennRobotokcpp11Accepted 50/5037ms5976 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/03ms1824 KiB
2Accepted0/032ms3916 KiB
3Accepted2/22ms2260 KiB
4Accepted2/22ms2300 KiB
5Accepted2/22ms2560 KiB
6Accepted2/23ms2612 KiB
7Accepted2/23ms2608 KiB
8Accepted2/23ms2584 KiB
9Accepted2/23ms2796 KiB
10Accepted2/23ms3000 KiB
11Accepted2/26ms3384 KiB
12Accepted2/218ms4280 KiB
13Accepted2/22ms3344 KiB
14Accepted2/232ms5572 KiB
15Accepted2/228ms5700 KiB
16Accepted2/237ms5640 KiB
17Accepted4/428ms5692 KiB
18Accepted6/628ms5768 KiB
19Accepted6/632ms5828 KiB
20Accepted6/627ms5976 KiB