QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#100848#1806. Character Gridckiseki#WA 2ms3504kbC++20944b2023-04-28 13:09:482023-04-28 13:09:51

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-28 13:09:51]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3504kb
  • [2023-04-28 13:09:48]
  • 提交

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