Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133894 | 吴晨曦 | 监测点 | C++ | 解答错误 | 0 | 3 MS | 256 KB | 581 | 2024-03-02 10:25:15 |
#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 = 0; 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 = 1; i < n; i++) { ans++; if (cur < a[i + 1].x) cur = a[i + 1].y, ans++; } cout << ans << endl; } }