73322024-01-07 17:41:48anonRobotokcpp17Accepted 50/5045ms8468 KiB
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define FastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long long ll;
int main() {
    FastIO;
    ll i, N, M, K;
    cin >> N >> M >> K;
    vector<array<ll, 2>> objs(K);
    for(i = 0; i < K; i++)
        cin >> objs[i][0] >> objs[i][1];
    sort(all(objs));
    vector<ll> robots;
    for(const auto &x : objs) {
        auto it = lower_bound(all(robots), -x[1]);
        if(it == robots.end())
            robots.push_back(-x[1]);
        else
            *it = -x[1];
    }
    cout << robots.size() << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1828 KiB
2Accepted0/039ms4684 KiB
3Accepted2/23ms2336 KiB
4Accepted2/23ms2336 KiB
5Accepted2/23ms2556 KiB
6Accepted2/24ms2624 KiB
7Accepted2/24ms2876 KiB
8Accepted2/23ms3124 KiB
9Accepted2/23ms3336 KiB
10Accepted2/23ms3516 KiB
11Accepted2/28ms3664 KiB
12Accepted2/223ms4768 KiB
13Accepted2/23ms3740 KiB
14Accepted2/239ms7936 KiB
15Accepted2/235ms7976 KiB
16Accepted2/245ms8024 KiB
17Accepted4/435ms8248 KiB
18Accepted6/635ms8200 KiB
19Accepted6/639ms8448 KiB
20Accepted6/632ms8468 KiB