Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
35683 未知 友好城市 C++ 通过 100 2 MS 312 KB 526 2021-12-17 13:51:33

Tests(12/12):


#include<bits/stdc++.h> using namespace std; struct node { int north,south; } a[200005]; int n,i,d[200005],len,temp,f1,f2; bool cmp(node x,node y) { return x.north<y.north; } int main () { cin.tie(0); cin>>f1>>f2>>n; for(i=1; i<=n; i++) cin>>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 l=upper_bound(d+1,d+len+1,a[i].south)-d; d[l]=a[i].south; if(l>len) len++; } cout<<len<<'\n'; return 0; }


测评信息: