有一个数据错了,请大佬帮忙看看
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
struct match
{
int a, b;
}bs[maxn];
bool cmp(match x, match y)
{
return x.b < y.b;
if (x.b == y.b) return x.a < y.a;
}
int main()
{
int n, cnt = 1;
cin >> n;
int j = 2;
for (int i = 1; i <= n; i++)
cin >> bs[i].a >> bs[i].b;
sort(bs + 1, bs + n, cmp);
int ini = bs[1].b;
while(n--)
{
if (bs[j].a >= ini)
{
cnt++;
ini = bs[j].b;
}
j++;
}
cout << cnt << endl;
return 0;
}