Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
133838 | 吴晨曦 | 电视节目安排 | C++ | 解答错误 | 50 | 0 MS | 252 KB | 473 | 2024-03-02 09:47:07 |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 005; struct Node{ int s, e; bool operator < (const Node &o) const { if (e != o.e) return e < o.e; return s < o.s; } }a[N]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i].s >> a[i].e; sort (a + 1, a + n + 1); int nowe = a[1].e, s = 0; for (int i = 2; i <= n; i++) { if (nowe <= a[i].s) nowe = a[i].e, s++; } cout << s + 1 << endl; }