Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133940 | 凌艺樽 | 监测点 | C++ | 解答错误 | 10 | 3 MS | 260 KB | 574 | 2024-03-02 10:53:23 |
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; int n,x; bool f[N]; struct point{ int s,e; }a[N]; bool cmp(point x,point y) { return x.e<y.e; } int main() { cin>>x; while(x--) { cin>>n; int ans=0; for(int i=1;i<=n;++i) { cin>>a[i].s>>a[i].e; } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;++i) { bool f1=0; for(int j=a[i].s;j<=a[i].e;++j) { if(f[j]==1) { f1=1; break; } } if(!f1) { f[a[i].e]=1; ans++; } } cout<<ans<<'\n'; } return 0; }