Skip to content

Instantly share code, notes, and snippets.

@modos
Created April 23, 2023 22:51
Show Gist options
  • Save modos/bd301719a6422bdaf4e6a47781f57cee to your computer and use it in GitHub Desktop.
Save modos/bd301719a6422bdaf4e6a47781f57cee to your computer and use it in GitHub Desktop.
بازار موبایل
#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