1152021-01-13 16:12:24mraronRobotokcpp11Accepted 50/5074ms23740 KiB
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,m,k;
	cin>>n>>m>>k;
	vector<int> col[100001];
	for(int i=0;i<k;++i) {
		int x,y;
		cin>>x>>y;
		col[y].push_back(x);
	}
	for(auto& i:col) sort(i.begin(), i.end());
	
	multiset<int> akt;
	for(int i=1;i<=m;++i) {
		for(auto j:col[i]) {
			auto it=akt.lower_bound(j+1);
			if(!akt.empty() && it!=akt.begin()) {
				akt.erase(prev(it));
				akt.insert(j);
			}else {
				akt.insert(j);
			}
		}
	}
	
	cout<<akt.size()<<"\n";
		
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/04ms6400 KiB
2Accepted0/054ms10976 KiB
3Accepted2/23ms7416 KiB
4Accepted2/24ms7424 KiB
5Accepted2/23ms7428 KiB
6Accepted2/24ms7600 KiB
7Accepted2/24ms7496 KiB
8Accepted2/24ms7524 KiB
9Accepted2/24ms7528 KiB
10Accepted2/24ms7632 KiB
11Accepted2/28ms7856 KiB
12Accepted2/220ms8720 KiB
13Accepted2/23ms8072 KiB
14Accepted2/259ms16548 KiB
15Accepted2/250ms17924 KiB
16Accepted2/257ms17800 KiB
17Accepted4/474ms21724 KiB
18Accepted6/654ms19732 KiB
19Accepted6/657ms23732 KiB
20Accepted6/665ms23740 KiB