QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#288088 | #6305. Chinese Checker | Jacka1# | Compile Error | / | / | C++14 | 4.2kb | 2023-12-21 19:57:34 | 2023-12-21 19:57:35 |
Judging History
answer
int main() {}
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int solve = []() {
const vector<pair<int, int>> dir = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, 1}, {-1, -1}};
vector<vector<pair<int, int>>> real(18, vector<pair<int, int>>(18));
vector<vector<int>> ok(18, vector<int>(18));
for (int i = 1; i <= 13; i++) {
if (i > 4 and i <= 8) continue;
for (int j = 1; j <= i; j++) {
real[i][j] = {i, j + 4};
ok[i][j + 4] = 1;
}
}
for (int i = 1; i <= 13; i++) {
if (i > 4 and i <= 9) continue;
for (int j = i; j <= 13; j++) {
real[i + 4][j - i + 1] = {i + 4, j};
ok[i + 4][j] = 1;
}
}
int T;
cin >> T;
auto [rx, ry] = real[9][9];
while (T--) {
int n;
cin >> n;
vector<vector<int>> vis(18, vector<int>(18));
vector<vector<int>> grid(18, vector<int>(18));
while (n--) {
int x, y;
cin >> x >> y;
auto [rx, ry] = real[x][y];
grid[rx][ry] = 1;
}
int ans = 0;
auto outside = [&](int x, int y) {
if (x < 1 or x > 17 or y < 1 or y > 17) return true;
return not ok[x][y];
};
auto valid = [&](int x, int y) {
return not outside(x, y) and not grid[x][y] and not vis[x][y];
};
for (int i = 1; i <= 17; i++) {
for (int j = 1; j <= 17; j++) {
if (grid[i][j]) {
set<pair<int, int>> S;
auto dfs = [&](auto self, int x, int y) -> void {
vis[x][y] = 1;
S.emplace(x, y);
for (auto& [dx, dy] : dir) {
int tx = x, ty = y;
int mx = -1, my = -1;
while (true) {
tx += dx, ty += dy;
if (outside(tx, ty)) {
break;
}
if (grid[tx][ty]) {
mx = tx;
my = ty;
break;
}
}
if (mx == -1) {
continue;
} else {
int gx = 2 * mx - x;
int gy = 2 * my - y;
if (valid(gx, gy)) {
bool ok = true;
int bx = mx, by = my;
while (true) {
bx += dx;
by += dy;
if (pair(bx, by) == pair(gx, gy)) {
break;
}
if (grid[bx][by]) {
ok = false;
break;
}
}
if (not ok) {
continue;
}
grid[x][y] = 0;
grid[gx][gy] = 1;
vis[gx][gy] = 1;
self(self, gx, gy);
grid[x][y] = 1;
grid[gx][gy] = 0;
vis[gx][gy] = 0;
}
}
}
vis[x][y] = 0;
};
dfs(dfs, i, j);
ans += S.size() - 1;
}
}
}
cout << ans << '\n';
}
return 0;
}();
Details
answer.code: In lambda function: answer.code:29:10: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ 29 | auto [rx, ry] = real[9][9]; | ^ answer.code:38:18: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ 38 | auto [rx, ry] = real[x][y]; | ^ answer.code: In lambda function: answer.code:58:36: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ 58 | for (auto& [dx, dy] : dir) { | ^ answer.code:83:49: error: missing template arguments before ‘(’ token 83 | if (pair(bx, by) == pair(gx, gy)) { | ^ answer.code:83:65: error: missing template arguments before ‘(’ token 83 | if (pair(bx, by) == pair(gx, gy)) { | ^