This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define ld long double
#define ar array
const int INF = 1e12;
const int MOD = 1e9+7;
void solve() {
int N; cin >> N;
vector<ar<int,2>> A(N);
for (auto &i : A) cin >> i[0] >> i[1];
int p = 0;
for (auto [l1, r1] : A) {
for (auto [l2, r2] : A) {
int inbet = (l1 <= l2 && r2 <= r1) || (l2 <= l1 && r1 <= r2);
if (!inbet && !(r1 <= l2 || r2 <= l1)) p++;
}
}
p /= 2; p = N - p;
int ans = 1, omk = 2;
if (p <= 0) ans = p = 0;
while (p) {
if (p & 1) ans = (ans*omk)%MOD;
omk = (omk*omk)%MOD; p >>= 1;
}
cout << ans << '\n';
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t = 1; //cin >> t;
while (t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |