Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main()
- {
- vector<pair<int, int>> v;
- int n;
- cin >> n;
- for(int i = 0; i < n; i++) {
- int a, b;
- cin >> a >> b;
- v.push_back(make_pair(b, a));
- }
- sort(v.begin(), v.end());
- int res = 1;
- int vreme = v[0].first;
- for(int i = 1; i < n; i++) {
- if(vreme <= v[i].second) {
- res++;
- vreme = v[i].first;
- }
- }
- cout << res << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement