| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 133756 | 黄一航 | 电视节目安排 | C++ | Accepted | 100 | 3 MS | 248 KB | 735 | 2024-03-02 09:04:51 |
#include <bits/stdc++.h> #define LYY_doesnt_have_m_ante long long using namespace std; pair<LYY_doesnt_have_m_ante,LYY_doesnt_have_m_ante> a[105]; bool cmp(pair<LYY_doesnt_have_m_ante,LYY_doesnt_have_m_ante> x,pair<LYY_doesnt_have_m_ante,LYY_doesnt_have_m_ante> y) { return x.second < y.second; } signed main() { LYY_doesnt_have_m_ante n; cin >> n; while (n) { for (LYY_doesnt_have_m_ante i = 1; i <= n; i++) cin >> a[i].first >> a[i].second; sort(a + 1,a + n + 1,cmp); LYY_doesnt_have_m_ante nowen = a[1].second,cnt = 1; for (LYY_doesnt_have_m_ante i = 2; i <= n; i++) { if (a[i].first >= nowen) cnt++,nowen = a[i].second; } printf("%lld\n",cnt); cin >> n; } return 0; }