QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#252015 | #7629. Make SYSU Great Again II | ucup-team004 | WA | 1ms | 3460kb | C++20 | 1.3kb | 2023-11-15 14:38:08 | 2023-11-15 14:38:08 |
Judging History
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