Created
April 23, 2023 22:51
-
-
Save modos/bd301719a6422bdaf4e6a47781f57cee to your computer and use it in GitHub Desktop.
بازار موبایل
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main() { | |
int n; | |
cin >> n; | |
vector<pair<int, int>> phones(n); | |
for (int i = 0; i < n; i++) { | |
int p, q; | |
cin >> p >> q; | |
phones[i] = make_pair(p, q); | |
} | |
int good_phones = 0; | |
for (auto phone : phones) { | |
bool is_good = true; | |
for (auto other_phone : phones) { | |
if (phone != other_phone && other_phone.first <= phone.first && other_phone.second >= phone.second) { | |
is_good = false; | |
break; | |
} | |
} | |
if (is_good) { | |
good_phones++; | |
} | |
} | |
cout << good_phones << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment