Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133903 | 吴晨曦 | 监测点 | C++ | 通过 | 100 | 3 MS | 256 KB | 556 | 2024-03-02 10:27:58 |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 005; struct Node{ int x, y; bool operator < (const Node &o) const { if (y != o.y) return y < o.y; return x < o.x; } }; int main() { int x; cin >> x; for (int adf = 1; adf <= x; adf++) { static Node a[N]; int n, ans = 1; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i].x >> a[i].y; sort(a + 1, a + n + 1); int cur = a[1].y; for (int i = 2; i <= n; i++) if (cur < a[i].x) cur = a[i].y, ans++; cout << ans << endl; } }