This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
_ _ __ _ _ _ _ _ _
|a ||t ||o d | |o |
| __ _| | _ | __| _ |
| __ |/_ | __ /__\ / _\|
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N_MAX = 20;
int N;
int L[N_MAX + 2], R[N_MAX + 2];
bool color[N_MAX + 2];
bool check () {
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
if (color[i] == color[j] && L[i] < L[j] && L[j] < R[i] && R[i] < R[j]) {
return false;
}
}
}
return true;
}
int main () {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> L[i] >> R[i];
}
int answer = 0;
for (int mask = 0; mask < (1 << N); mask += 2) {
for (int i = 1; i <= N; i++) {
color[i] = ((mask >> (i - 1)) & 1);
}
answer += check();
}
answer *= 2;
cout << answer << "\n";
return 0;
}
# | 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... |