QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#334005#4325. Kraljicelukap_0 1ms3680kbC++142.4kb2024-02-20 23:06:302024-02-20 23:06:30

Judging History

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

  • [2024-02-20 23:06:30]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3680kb
  • [2024-02-20 23:06:30]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int n;
vector<pair<int, int> > rj;

void play (int x, int y) {
    rj.push_back ({x, y});
}

void tri () {
    play (2, 3);
    play (3, 1);
    play (2, 2);
    play (1, 1);
    play (3, 3);
    play (3, 2);
    play (1, 2);
    play (1, 3);
    play (2, 1);
}

void cetiri () {
    play (1, 1);
    play (2, 4);
    play (1, 4);
    play (2, 1);
    play (3, 1);
    play (4, 1);
    play (4, 4);
    play (3, 4);
    play (1, 2);
    play (2, 2);
    play (4, 3);
    play (2, 3);
    play (3, 3);
    play (3, 2);
}

void par (int x) {
    play (x - 2, x);
    play (x - 2, x - 1);
    play (x - 1, x);
    play (x - 1, x - 2);
    play (x, x - 2);
    play (x - 1, x - 1);
    play (x, x - 1);
    play (x, x);
}

void nepar (int x) {
    play (x - 1, x);
    play (x - 2, x - 1);
    play (x, x - 1);
    play (x - 1, x - 1);
    play (x - 2, x);
    play (x, x - 2);
    play (x - 1, x - 2);
    play (x, x);
}

void solve (int x) {
    if (x == 3) {
        tri ();
        return;
    }
    if (x == 4) {
        cetiri ();
        return;
    }

    solve (x - 2);

    for (int i = 0; i < x - 3; i++) {
        int prvi = (x - 2) + 0 + i + 0 + i + max ((x - (i + 1) - 1), 0) + 1 + 0;
        if (i == 0) prvi -= 2;

        int drugi = (x - 2) + 0 + i + 0 + max (i - 1, 0) + max ((x - (i + 1) - 3), 0) + 0 + 0;

        if (prvi % 2 == 0) {
            play (x - 1, i + 1);
            play (x, i + 1);
        }
        else {
            play (x, i + 1);
            play (x - 1, i + 1);
        }

        prvi = i + 0 + (x - 2) + 0 + i + i + (x - 2 - (i - 1)) + 0;
        if (i == 0) prvi--;

        drugi = i + 0 + (x - 2) + 0 + i + 0 + (x - 1 - i - 2) + 0;

        if (prvi % 2 == 0) {
            play (i + 1, x - 1);
            play (i + 1, x);
        }
        else {
            play (i + 1, x);
            play (i + 1, x - 1);
        }

    }

    if (x % 2 == 0) par (x);
    else nepar (x);
}

int main () {
    ios_base::sync_with_stdio (false);
    cin.tie (0);

    cin >> n;

    if (n == 1) {
        play (1, 1);
    }
    else if (n == 2) {
        play (1, 1);
    }
    else solve (n);

    cout << rj.size () << "\n";
    for (auto it: rj) cout << it.first << ' ' << it.second << "\n";

    return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 6
Accepted
time: 1ms
memory: 3580kb

input:

1

output:

1
1 1

result:

ok 1 queen(s)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

2

output:

1
1 1

result:

ok 1 queen(s)

Test #3:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

3

output:

9
2 3
3 1
2 2
1 1
3 3
3 2
1 2
1 3
2 1

result:

ok 9 queen(s)

Test #4:

score: 0
Accepted
time: 1ms
memory: 3604kb

input:

4

output:

14
1 1
2 4
1 4
2 1
3 1
4 1
4 4
3 4
1 2
2 2
4 3
2 3
3 3
3 2

result:

ok 14 queen(s)

Test #5:

score: 0
Accepted
time: 1ms
memory: 3680kb

input:

5

output:

25
2 3
3 1
2 2
1 1
3 3
3 2
1 2
1 3
2 1
5 1
4 1
1 4
1 5
4 2
5 2
2 5
2 4
4 5
3 4
5 4
4 4
3 5
5 3
4 3
5 5

result:

ok 25 queen(s)

Test #6:

score: -6
Wrong Answer
time: 0ms
memory: 3644kb

input:

6

output:

34
1 1
2 4
1 4
2 1
3 1
4 1
4 4
3 4
1 2
2 2
4 3
2 3
3 3
3 2
6 1
5 1
1 5
1 6
5 2
6 2
2 6
2 5
6 3
5 3
3 6
3 5
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6

result:

wrong answer the cell (5, 1) is attacking by 7 queen(s)

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%