标签:text style mil for ret 会场安排 注意 测试数据 时间表
2
2
1 10
10 11
3
1 10
10 11
11 20
1
2
#include <iostream> #include <stdio.h> #include <algorithm> using namespace std; const int maxn = 11000; struct ac { int b, e; }; ac a[maxn]; int cmp(ac a, ac b) { return a.e < b.e; } int main() { //freopen("1.txt", "r", stdin); int T; cin >> T; while (T--) { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i].b >> a[i].e; sort(a, a+n, cmp); int cnt = 1, pre = a[0].e; for (int i = 1; i < n; i++) { if (pre < a[i].b) { cnt++; pre = a[i].e; } } cout << cnt << endl; } return 0; }
标签:text style mil for ret 会场安排 注意 测试数据 时间表
原文地址:http://www.cnblogs.com/whileskies/p/7106501.html