Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdlib>
- #include<vector>
- #define long long long
- #define nln '\n'
- #define rtg pair<pair<long, long>, pair<long, long>>
- using namespace std;
- bool common(const rtg &a, const rtg &b)
- {
- if (a.second.first <= b.first.first || a.second.second <= b.first.second)
- return 0;
- if (a.first.first >= b.second.first || a.first.second >= b.second.second)
- return 0;
- return 1;
- }
- int main()
- {
- cin.tie(0)->sync_with_stdio(0);
- cout.tie(0)->sync_with_stdio(0);
- //freopen("pin.inp", "r", stdin);
- long n;
- cin >> n;
- vector<rtg> a(n);
- for (auto &i : a)
- cin >> i.first.first >> i.first.second >> i.second.first >> i.second.second;
- // Process
- long ans = 0;
- for (long i = 0; i < n; ++i)
- for (long j = i+1; j < n; ++j)
- if (common(a[i], a[j]))
- ++ans;
- cout << ans << nln;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment