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