AC

名字不要取太长像我这样应该刚刚好  •  22天前


不是你看得懂吗

include <bits/stdc++.h>

using namespace std;

struct arae {

int l, r;
bool operator < (arae a2) {
	return r < a2.r;
}

} a[100005];

int main() {

int n, last = -1e9 - 7, ans = 0;
cin >> n;
for (int i = 1; i <= n; i++)
	cin >> a[i].l >> a[i].r;
sort(a + 1, a + 1 + n);
for (int i = 1; i <= n; i++) {
	if (a[i].l > last) {
		ans++;
		last = a[i].r;
	}
}
cout << ans;
return 0;

}


评论:

请先登录,才能进行评论