Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
134997 | 黄恩宁 | 监测点 | C++ | 运行出错 | 70 | 3 MS | 252 KB | 495 | 2024-03-03 23:16:10 |
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; struct node { int a,b; }; bool cmp(node x,node y) { // if(x.a!=y.a) return x.a<=y.a; return x.b<=y.b; } const int NR=110; node c[NR]; int main() { int x; cin>>x; while(x--) { int n,mx=0,ans=0,i; cin>>n; for(i=1;i<=n;i++) cin>>c[i].a>>c[i].b; sort(c+1,c+n+1,cmp); for(i=1;i<=n;i++) if(c[i].a>mx) { mx=c[i].b; ans++; } cout<<ans<<endl; } return 0; }