Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
119145 陈家宝 友好城市 C++ Accepted 100 1 MS 320 KB 542 2024-01-04 13:29:10

Tests(12/12):


#include<bits/stdc++.h> using namespace std; struct node { int north; int south; }; node a[200005]; int n,i,d[200005],len,temp,fuck1,fuck2; bool cmp(node x,node y) { return x.north<y.north; } int main () { scanf("%d%d%d",&fuck1,&fuck2,&n); for(i=1; i<=n; i++) scanf("%d%d",&a[i].north,&a[i].south); sort(a+1,a+1+n,cmp); d[++len]=a[1].south; for(i=2; i<=n; i++){ int lgh=upper_bound(d+1,d+len+1,a[i].south)-d; d[lgh]=a[i].south; if(lgh>len)len++; } printf("%d",len); return 0; }


Judgement Protocol: