QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#385870#7629. Make SYSU Great Again IIKKT89WA 1ms3860kbC++171.3kb2024-04-11 09:17:392024-04-11 09:17:40

Judging History

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

  • [2024-04-11 09:17:40]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3860kb
  • [2024-04-11 09:17:39]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) { return (ull)rng() % B; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n));
    int m = 4 * n * n;
    vector<short> cnt(m);
    auto dfs = [&](auto dfs, int x, int y) -> void {
        if (x == n) {
            cout << "Yes\n";
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (j) cout << " ";
                    cout << a[i][j];
                }
                cout << "\n";
            }
            exit(0);
        }
        if (y == n) {
            dfs(dfs, x + 1, 0);
            return;
        }
        for (int _ = 0; _ < 100; _++) {
            int u = myRand(m);
            if (cnt[u] == 5) continue;
            if (x and (a[x - 1][y] & a[x][y])) continue;
            if (y and (a[x][y - 1] & a[x][y])) continue;
            cnt[u] += 1;
            a[x][y] = u;
            dfs(dfs, x, y + 1);
            cnt[u] -= 1;
        }
    };
    dfs(dfs, 0, 0);
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3860kb

input:

4

output:

Yes
29 25 38 57
25 9 1 22
20 42 7 14
14 13 13 27

result:

wrong answer There exist two adjacent numbers whose bitwise AND value is greater than 0.