| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 531598 | eecs | L-triominoes (CEOI21_ltriominoes) | C++17 | 1395 ms | 4540 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 <bits/stdc++.h>
using namespace std;
int W, H, K, x[250], y[250];
bitset<1 << 13> f, g;
vector<array<int, 2>> E;
int main() {
scanf("%d %d %d", &W, &H, &K);
vector<int> pos = {1, H};
for (int S = 0; S < 1 << W; S++) {
function<void(int, int)> dfs = [&](int i, int T) {
if (i == W) { E.push_back({S, T}); return; }
if (S >> i & 1) return dfs(i + 1, T);
if (i && !(T >> (i - 1) & 1) && !(T >> i & 1)) dfs(i + 1, T | (1 << (i - 1)) | (1 << i));
if (i + 1 == W) return;
if (!(T >> i & 1) && !(T >> (i + 1) & 1)) dfs(i + 1, T | (1 << i) | (1 << (i + 1)));
if (!(S >> (i + 1) & 1) && !(T >> i & 1)) dfs(i + 2, T | (1 << i));
if (!(S >> (i + 1) & 1) && !(T >> (i + 1) & 1)) dfs(i + 2, T | (1 << (i + 1)));
};
dfs(0, 0);
}
for (int i = 0; i < K; i++) {
scanf("%d %d", &x[i], &y[i]), pos.push_back(y[i]);
}
sort(pos.begin(), pos.end());
pos.resize(unique(pos.begin(), pos.end()) - pos.begin());
f[0] = 1;
for (int i = 0; i < pos.size(); i++) {
g.reset();
int S = 0;
for (int j = 0; j < K; j++) {
if (pos[i] == y[j]) S |= 1 << (x[j] - 1);
}
for (int j = 0; j < 1 << W; j++) {
if (!(j & S)) g[j | S] = f[j];
}
swap(f, g);
if (i == pos.size() - 1) break;
int n = pos[i + 1] - pos[i];
if (n >= 6) n = n % 6 + 6;
for (int $ = 0; $ < n; $++) {
g.reset();
for (auto &e : E) if (f[e[0]]) g[e[1]] = 1;
swap(f, g);
}
}
puts(f[(1 << W) - 1] ? "YES" : "NO");
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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
