# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066669 | sleepntsheep | Plus Minus (BOI17_plusminus) | C++17 | 0 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 <cstdio>
int n, m, k, a[6][6], x[55], y[55], v[55], ans, s[6][6];
int main() {
scanf("%d%d%d", &n, &m, &k);
for (int i = 0; i < k; ++i) {
char c;
scanf(" %c%d%d", &c, x + i, y + i), s[x[i]-1][y[i]-1] = c;
}
if (n <= 5 and m <= 5) {
for (int i = 0; i < (1 << n); ++i) {
for (int ii = 0; ii < n; ++ii) a[ii][0] = (i >> ii) & 1;
for (int j = 0; j < (1 << m); ++j) {
if ((j & 1) != (i & 1)) continue;
for (int jj = 0; jj < m; ++jj) a[0][jj] = (j >> jj) & 1;
for (int k = 1; k < n; ++k) for (int l = 1; l < m; ++l) {
a[k][l] = 2 - (a[k-1][l-1] + a[k-1][l] + a[k][l-1]);
if (a[k][l] < 0 or a[k][l] > 1)
goto NX;
}
for (int k = 0; k < n; ++k) for (int l = 0; l < m; ++l) {
if (s[k][l] == '+' and a[k][l] == 0) goto NX;
if (s[k][l] == '-' and a[k][l] == 1) goto NX;
}
++ans;
NX:;
}
}
}
printf("%d", ans);
}
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... |