# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066690 | sleepntsheep | Alternating Current (BOI18_alternating) | C++17 | 6 ms | 600 KiB |
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 <stdio.h>
int n, m, a[16], b[16];
int main() {
scanf("%d%d", &n, &m);
for (int i = 0; i < m; ++i) scanf("%d%d", a + i, b + i), --a[i], --b[i];
for (int ii = 0; ii < (1 << m); ++ii) {
for (int i = 0; i < n; ++i) {
int c {};
for (int j = 0; j < m; ++j) {
int dir = (ii >> j) & 1;
if (a[j] <= b[j]) {
if (a[j] <= i && i <= b[j]) c |= 1 << dir;
} else {
if (i <= b[j] or i >= a[j]) c |= 1 << dir;
}
}
if (c != 3) goto NX;
}
for (int j = 0; j < m; ++j) {
putchar('0' + ((ii >> j) & 1));
}
return 0;
NX:;
}
puts("impossible");
return 0;
}
Compilation message (stderr)
# | 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... |