Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133737 | 廖悦扬 | 监测点 | C++ | 通过 | 100 | 1 MS | 248 KB | 523 | 2024-03-02 09:00:38 |
#include <bits/stdc++.h> using namespace std; const int N = 100 + 5; int n, t; struct st{ int l, r; bool operator<(const st& a) { return r < a.r; } } stu[N]; signed main() { scanf("%d", &t); while (t--) { scanf("%d", &n); for (int i=1; i<=n; i++) { scanf("%d%d", &stu[i].l, &stu[i].r); } sort(stu+1, stu+1+n); int lst = 0, ans = 0; for (int i=1; i<=n; i++) { if (lst < stu[i].l) { lst = stu[i].r; ans++; } } printf("%d\n", ans); } return 0; }