15882022-11-28 18:25:39lacitoRobotokcpp11Accepted 50/5082ms7452 KiB
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, m, k;
	cin >> n >> m >> k;
	vector<pair<int, int>> pont;
	for (int i = 0; i < k; i++) {
		int a, b;
		cin >> a >> b;
		pont.push_back(make_pair(a, b));
	}
	sort(pont.begin(), pont.end());
	vector<int> ordinata;
	for (int i = 0; i < k; i++) {
		ordinata.push_back(pont[i].second);
	}
	vector<int> mo;
	for (int i = 0; i < k; i++) {
		auto it = lower_bound(mo.begin(), mo.end(), -ordinata[i]);
		if (it == mo.end()) {
			mo.push_back(-ordinata[i]);
		} else {
			*it = -ordinata[i];
		}
	}
	cout << mo.size();
}

SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1808 KiB
2Accepted0/068ms4948 KiB
3Accepted2/22ms2052 KiB
4Accepted2/22ms2248 KiB
5Accepted2/22ms2456 KiB
6Accepted2/24ms2628 KiB
7Accepted2/24ms2852 KiB
8Accepted2/23ms2900 KiB
9Accepted2/23ms3112 KiB
10Accepted2/23ms3032 KiB
11Accepted2/212ms3772 KiB
12Accepted2/234ms4588 KiB
13Accepted2/23ms3352 KiB
14Accepted2/275ms6464 KiB
15Accepted2/272ms6480 KiB
16Accepted2/282ms6720 KiB
17Accepted4/472ms6920 KiB
18Accepted6/674ms7144 KiB
19Accepted6/675ms7176 KiB
20Accepted6/671ms7452 KiB