提交时间:2024-03-30 15:54:47
运行 ID: 140571
#include<bits/stdc++.h> #define int long long using namespace std; struct P{ int x,y; }s[114514]; bool cmp(P a,P b){ if (a.x == b.x){ return a.y < b.y; } return a.x < b.x; } vector <int> wwzissocute; signed main(){ int n,m,p; cin>>n>>m>>p; for (int i = 1;i <= p;i++){ cin>>s[i].x>>s[i].y; } sort(s + 1,s + p + 1,cmp); int cnt = 0; for (int i = 1;i <= p;i++){ bool f = true; for (int j = 0;j < cnt;j++){ if (wwzissocute[j] <= s[i].y){ wwzissocute[j] = s[i].y; f = false; break; } } if (f){ cnt++; wwzissocute.push_back(s[i].y); } } cout<<cnt; return 0; }