23152023-01-10 12:24:27rennRobotokcpp11Accepted 50/5039ms7164 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);
    int a, b;
    for(int i = 0; i < pont; i++){
        cin >> a >> b;
        pontok[i] = {a, b};
    }
    sort(pontok.begin(), pontok.end());

    vector<int> o;
    o.reserve(pont);
    for(auto x : pontok){
        o.push_back(-x.second);
    }

    vector<int> indulok;
    for(int i = 0; i < pont; i++){
        auto ind = lower_bound(indulok.begin(), indulok.end(), o[i]);
        if(ind == indulok.end()){
            indulok.push_back(o[i]);
        }
        else{
            *ind = o[i];
        }
    }

    cout << indulok.size() << "\n";
    
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1836 KiB
2Accepted0/034ms3880 KiB
3Accepted2/22ms2228 KiB
4Accepted2/22ms2428 KiB
5Accepted2/22ms2660 KiB
6Accepted2/23ms3044 KiB
7Accepted2/23ms2984 KiB
8Accepted2/23ms3220 KiB
9Accepted2/23ms3552 KiB
10Accepted2/23ms3464 KiB
11Accepted2/26ms3868 KiB
12Accepted2/219ms4384 KiB
13Accepted2/23ms3652 KiB
14Accepted2/234ms6924 KiB
15Accepted2/230ms6800 KiB
16Accepted2/239ms6796 KiB
17Accepted4/430ms6800 KiB
18Accepted6/630ms7164 KiB
19Accepted6/632ms6992 KiB
20Accepted6/628ms7148 KiB