알고리즘/BOJ
[1931번] 회의실배정
남현경
2018. 7. 30. 22:13
#include#include using namespace std; int N; pair P[100000]; int ans = 1; int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> P[i].second >> P[i].first; } sort(P, P + N); int end = P[0].first; for (int i = 1; i < N; i++) { if (P[i].second >= end) { end = P[i].first; ans++; } } cout << ans; return 0; }