QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#471892#4325. KraljicePorNPtree0 0ms3796kbC++171.3kb2024-07-11 11:03:092024-07-11 11:03:10

Judging History

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

  • [2024-07-11 11:03:10]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3796kb
  • [2024-07-11 11:03:09]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

vector< pair<int, int> > res;

const int N = 1100;

int c1[N], c2[N], c3[N + N], c4[N + N], vis[N][N];

void o(int x, int y) {
    if ((c1[x] ^ c2[y] ^ c3[x + y] ^ c4[x - y + N]) || vis[x][y]) return;
    res.push_back({x, y});
    c1[x] ^= 1, c2[y] ^= 1, c3[x + y] ^= 1, c4[x - y + N] ^= 1, vis[x][y] = 1;
}

void solve(int n) {
    if (n <= 2) { o(1, 1); return;}
    if (n & 1) {
        solve(n - 2);
        for (int i = 1; i <= n - 3; ++i) o(i, n - 1), o(i, n), o(i, n - 1), o(n - 1, i), o(n, i), o(n - 1, i);
        o(n - 1, n), o(n - 1, n - 1), o(n, n - 2), o(n - 2, n), o(n - 2, n - 1), o(n, n - 1), o(n - 1, n - 2), o(n, n);
        return;
    }
    solve(n - 3);
    o(n - 1, n);
    for (int j = 1; j <= 3; ++j) for (int i = 1; i <= n - 3; ++i) {
        o(i, n), o(n, i), o(i, n), o(i, n - 1), o(n - 1, i), o(i, n - 1), o(i, n - 2), o(n - 2, i), o(i, n - 2);
    }
    o(n - 2, n), o(n - 2, n - 2), o(n, n - 1), o(n - 1, n - 2), o(n - 1, n - 1), o(n, n);
}

signed main() {
    int n; scanf("%d", &n);
    solve(n);
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) putchar(vis[i][j] + '0');
        puts("");
    }
    printf("%d\n", (int)res.size());
    for (auto x : res) printf("%d %d\n", x.first, x.second);
    return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3796kb

input:

1

output:

1
1
1 1

result:

wrong output format Extra information in the output file

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%