Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- using namespace std;
- bool tem_sobreposicao(pair<int, int> a, pair<int, int> b) {
- return a.first >= b.first && a.first < b.second ||
- b.first >= a.first && b.first < a.second;
- }
- int main() {
- int n;
- vector<pair<int, int>> v;
- cin >> n;
- for(int i = 0; i < n; ++i) {
- int x, y;
- cin >> x >> y;
- v.push_back(make_pair(x, y));
- }
- for(int i = 0; i < n; ++i)
- for(int j = 0; j < n; ++j)
- if(i != j && tem_sobreposicao(v[i], v[j])) {
- cout << "YES\n";
- return 0;
- }
- cout << "NO\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement