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 ll = long long;
template <class T>
using Vec = std::vector<T>;
int main() {
int N, M;
std::cin >> N >> M;
Vec<int> A(M), B(M);
for (int i = 0; i < M; ++i) {
std::cin >> A[i] >> B[i];
A[i] -= 1;
B[i] -= 1;
}
if (N <= 15 and M <= 15) {
for (int set = 0; set < (1 << M); ++set) {
bool ok = true;
for (int i = 0; i < N; ++i) {
bool f = false, g = false;
for (int j = 0; j < M; ++j) {
if ((A[j] <= B[j] and A[j] <= i and i <= B[j]) or (A[j] > B[j] and (A[j] <= i or i <= B[j]))) {
((set >> j & 1) ? f : g) = true;
}
}
if (!f or !g) {
ok = false;
break;
}
}
if (ok) {
for (int j = 0; j < M; ++j) {
std::cout << (set >> j & 1);
}
std::cout << '\n';
return 0;
}
}
std::cout << "impossible\n";
return 0;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |