QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#252015#7629. Make SYSU Great Again IIucup-team004WA 1ms3460kbC++201.3kb2023-11-15 14:38:082023-11-15 14:38:08

Judging History

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

  • [2023-11-15 14:38:08]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3460kb
  • [2023-11-15 14:38:08]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int n;
    std::cin >> n;
    
    int k = 0;
    while ((1 << k) < n) {
        k += 1;
    }
    
    std::vector a(n, std::vector<int>(n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if ((i + j) % 2 == 0) {
                int u = (i + j) / 2;
                int v = (i - j) / 2 + n / 2;
                a[i][j] = (u ^ (u >> 1)) << k | (v ^ (v >> 1));
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if ((i + j) % 2 == 1) {
                int x = 0;
                if (i) {
                    x |= a[i - 1][j];
                }
                if (j) {
                    x |= a[i][j - 1];
                }
                if (i < n - 1) {
                    x |= a[i + 1][j];
                }
                if (j < n - 1) {
                    x |= a[i][j + 1];
                }
                x ^= (1 << (2 * k)) - 1;
                a[i][j] = x;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            std::cout << a[i][j] << " \n"[j == n - 1];
        }
    }
    
    return 0;
}

詳細信息

Test #1:

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

input:

4

output:

3 8 5 2
8 7 0 13
6 0 15 0
1 14 0 11

result:

wrong answer Unexpected Ans