8 条题解
-
1
AC日记
#include<bits/stdc++.h> using namespace std; int n=0,dp[114514],p=0,cntt=0,cnt=0; struct xy { int x,y; }; xy a[114514]; int cmp(xy x,xy y) { return x.x<y.x; } int main() { cin>>n>>p; cin>>cnt; for(int i=1;i<=cnt;i++) { cin>>a[i].x>>a[i].y; } sort(a+1,a+cnt+1,cmp); dp[1]=a[1].y; cntt=1; for(int i=2;i<=cnt;i++) { if(a[i].y>dp[cntt]) { cntt++; dp[cntt]=a[i].y; } else { int x=upper_bound(dp+1,dp+cntt+1,a[i].y)-dp; dp[x]=a[i].y; } } cout<<cntt; }
信息
- ID
- 1722
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- 递交数
- 671
- 已通过
- 161
- 上传者