QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#100848 | #1806. Character Grid | ckiseki# | WA | 2ms | 3504kb | C++20 | 944b | 2023-04-28 13:09:48 | 2023-04-28 13:09:51 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
char a[13][14];
set<pair<char, char>> s;
bool dfs(int i, int j) {
if (j == 13) {
return dfs(i + 1, 0);
} else if (i == 13) {
return true;
} else {
for (int x = 0; x < 13; ++x) {
a[i][j] = x + (i & 1) * 13 + 'a';
if (i and s.find({a[i - 1][j], a[i][j]}) != s.end())
continue;
if (j and s.find({a[i][j - 1], a[i][j]}) != s.end())
continue;
if (i) s.emplace(a[i - 1][j], a[i][j]);
if (j) s.emplace(a[i][j - 1], a[i][j]);
if (dfs(i, j + 1)) return true;
if (i) s.erase({a[i - 1][j], a[i][j]});
if (j) s.erase({a[i][j - 1], a[i][j]});
}
return false;
}
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
assert(dfs(0, 0));
for (int i = 0; i < 13; ++i)
cout << a[i] << '\n';
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3504kb
input:
output:
aabacadaeafag nonpnqnrnsntn ahbbcbdbebfbg unuoopoqoroso aibiajbhccdce vnvownwotppqp akbjalbkamcfd xnxoynyoznzpr bmdfchdgcjded touqrpspuptqq clcgefegdheci sqvqsrrsvrtwp ddiehfgffhgga
result:
wrong output format Expected integer, but "aabacadaeafag" found