QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#334382#4325. Kraljicelukap_45 210ms5872kbC++232.9kb2024-02-21 20:39:222024-02-21 20:39:23

Judging History

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

  • [2024-02-21 20:39:23]
  • 评测
  • 测评结果:45
  • 用时:210ms
  • 内存:5872kb
  • [2024-02-21 20:39:22]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define fi first
#define se second
#define pii pair<int, int>

const int MAX = 2e3 + 10;
int n, m;
int mat[MAX][MAX];
int smjer[8][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
vector <pii> v = {{1, 2}, {2, 4}, {1, 3}, {2, 1}, {2, 2}, {3, 4}, {1, 4}, {3, 1}, {3, 2}, {3, 3}, {4, 1}, {4, 3}, {4, 2}, {4, 4}};
vector <pii> v2 = {{2, 3}, {3, 1}, {2, 2}, {1, 1}, {3, 3}, {3, 2}, {1, 2}, {1, 3}, {2, 1}};
vector <pii> par = {{0, 2}, {0, 1}, {1, 2}, {1, 0}, {2, 0}, {1, 1}, {2, 1}, {2, 2}};
vector <pii> nep = {{1, 2}, {0, 1}, {2, 1}, {1, 1}, {0, 2}, {2, 0}, {1, 0}, {2, 2}};

bool moguce(int x, int y) {
    int cnt = 0;

    for (int i = 0; i < 8; i++) {
        int x2 = x;
        int y2 = y;

        while (x2 >= 1 && x2 <= m && y2 >= 1 && y2 <= m) {
            if (mat[x2][y2]) cnt++;

            x2 += smjer[i][0];
            y2 += smjer[i][1];
        }
    }

    if (cnt % 2 == 0) return true;
    return false;
}

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

    cin >> n;

    if (n <= 2) {
        cout << "1\n1 1\n";
        return 0;
    }

    if (n % 2 == 0) {
        cout << n * n - 2 << "\n";

        for (int i = 0; i < 14; i++) {
            cout << v[i].fi << " " <<  v[i].se << "\n";
            mat[v[i].fi][v[i].se] = 1;
        }
    }
    else {
        cout << n * n << "\n";

        for (int i = 0; i < 9; i++) {
            cout << v2[i].fi << " " <<  v2[i].se << "\n";
            mat[v2[i].fi][v2[i].se] = 1;
        }
    }

    int bla = 4;
    if (n % 2 == 0) bla = 5;
    m = n;
    for (int i = bla; i <= n; i += 2) {
        m += 2;

        for (int j = 1; j <= i - 2; j++) {
            if (moguce(i, j)) {
                cout << i << " " << j << "\n";
                cout << i + 1 << " " << j << "\n";
            }
            else {
                cout << i + 1 << " " << j << "\n";
                cout << i << " " << j << "\n";
            }

            mat[i][j] = 1;
            mat[i + 1][j] = 1;

            if (moguce(j, i)) {
                cout << j << " " << i << "\n";
                cout << j << " " << i + 1 << "\n";
            }
            else {
                cout << j << " " << i + 1 << "\n";
                cout << j << " " << i << "\n";
            }

            mat[j][i] = 1;
            mat[j][i + 1] = 1;
        }

        if (n % 2 == 0) {
            for (auto e : par) {
                int x = e.fi + i - 1;
                int y = e.se + i - 1;

                mat[x][y] = 1;
                cout << x << " " << y << "\n";
            }
        }
        else {
            for (auto e : nep) {
                int x = e.fi + i - 1;
                int y = e.se + i - 1;

                mat[x][y] = 1;
                cout << x << " " << y << "\n";
            }
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 6
Accepted

Test #1:

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

input:

1

output:

1
1 1

result:

ok 1 queen(s)

Test #2:

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

input:

2

output:

1
1 1

result:

ok 1 queen(s)

Test #3:

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

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: 3788kb

input:

4

output:

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

result:

ok 14 queen(s)

Test #5:

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

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: 0
Accepted
time: 0ms
memory: 3556kb

input:

6

output:

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

result:

ok 34 queen(s)

Test #7:

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

input:

7

output:

49
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7

result:

ok 49 queen(s)

Test #8:

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

input:

8

output:

62
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8

result:

ok 62 queen(s)

Test #9:

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

input:

9

output:

81
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9
7...

result:

ok 81 queen(s)

Test #10:

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

input:

10

output:

98
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 9
...

result:

ok 98 queen(s)

Test #11:

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

input:

11

output:

121
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9
...

result:

ok 121 queen(s)

Test #12:

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

input:

12

output:

142
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 9...

result:

ok 142 queen(s)

Test #13:

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

input:

13

output:

169
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9
...

result:

ok 169 queen(s)

Test #14:

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

input:

14

output:

194
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 9...

result:

ok 194 queen(s)

Test #15:

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

input:

15

output:

225
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9
...

result:

ok 225 queen(s)

Test #16:

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

input:

16

output:

254
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 9...

result:

ok 254 queen(s)

Subtask #2:

score: 11
Accepted

Dependency #1:

100%
Accepted

Test #17:

score: 11
Accepted
time: 0ms
memory: 3564kb

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 #18:

score: 0
Accepted
time: 2ms
memory: 3756kb

input:

54

output:

2914
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 ...

result:

ok 2914 queen(s)

Test #19:

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

input:

19

output:

361
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9
...

result:

ok 361 queen(s)

Test #20:

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

input:

44

output:

1934
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 ...

result:

ok 1934 queen(s)

Test #21:

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

input:

27

output:

729
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9
...

result:

ok 729 queen(s)

Test #22:

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

input:

58

output:

3362
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 ...

result:

ok 3362 queen(s)

Test #23:

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

input:

51

output:

2601
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9...

result:

ok 2601 queen(s)

Test #24:

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

input:

8

output:

62
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8

result:

ok 62 queen(s)

Test #25:

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

input:

15

output:

225
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9
...

result:

ok 225 queen(s)

Test #26:

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

input:

4

output:

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

result:

ok 14 queen(s)

Test #27:

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

input:

57

output:

3249
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9...

result:

ok 3249 queen(s)

Test #28:

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

input:

58

output:

3362
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 ...

result:

ok 3362 queen(s)

Test #29:

score: 0
Accepted
time: 2ms
memory: 3804kb

input:

61

output:

3721
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9...

result:

ok 3721 queen(s)

Test #30:

score: 0
Accepted
time: 3ms
memory: 3856kb

input:

62

output:

3842
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 ...

result:

ok 3842 queen(s)

Test #31:

score: 0
Accepted
time: 2ms
memory: 3808kb

input:

63

output:

3969
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9...

result:

ok 3969 queen(s)

Test #32:

score: 0
Accepted
time: 2ms
memory: 3776kb

input:

64

output:

4094
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 ...

result:

ok 4094 queen(s)

Subtask #3:

score: 28
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #33:

score: 28
Accepted
time: 0ms
memory: 3812kb

input:

61

output:

3721
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9...

result:

ok 3721 queen(s)

Test #34:

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

input:

10

output:

98
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 9
...

result:

ok 98 queen(s)

Test #35:

score: 0
Accepted
time: 14ms
memory: 4288kb

input:

157

output:

24649
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 ...

result:

ok 24649 queen(s)

Test #36:

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

input:

12

output:

142
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 9...

result:

ok 142 queen(s)

Test #37:

score: 0
Accepted
time: 4ms
memory: 3940kb

input:

91

output:

8281
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9...

result:

ok 8281 queen(s)

Test #38:

score: 0
Accepted
time: 3ms
memory: 3856kb

input:

84

output:

7054
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 ...

result:

ok 7054 queen(s)

Test #39:

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

input:

33

output:

1089
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9...

result:

ok 1089 queen(s)

Test #40:

score: 0
Accepted
time: 4ms
memory: 4164kb

input:

94

output:

8834
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3 ...

result:

ok 8834 queen(s)

Test #41:

score: 0
Accepted
time: 25ms
memory: 4484kb

input:

205

output:

42025
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 ...

result:

ok 42025 queen(s)

Test #42:

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

input:

4

output:

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

result:

ok 14 queen(s)

Test #43:

score: 0
Accepted
time: 47ms
memory: 4784kb

input:

237

output:

56169
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 ...

result:

ok 56169 queen(s)

Test #44:

score: 0
Accepted
time: 35ms
memory: 4752kb

input:

228

output:

51982
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3...

result:

ok 51982 queen(s)

Test #45:

score: 0
Accepted
time: 45ms
memory: 4800kb

input:

245

output:

60025
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 ...

result:

ok 60025 queen(s)

Test #46:

score: 0
Accepted
time: 49ms
memory: 4800kb

input:

252

output:

63502
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3...

result:

ok 63502 queen(s)

Test #47:

score: 0
Accepted
time: 50ms
memory: 4804kb

input:

255

output:

65025
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 ...

result:

ok 65025 queen(s)

Test #48:

score: 0
Accepted
time: 55ms
memory: 4928kb

input:

256

output:

65534
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
3...

result:

ok 65534 queen(s)

Subtask #4:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #49:

score: 55
Accepted
time: 1ms
memory: 3724kb

input:

27

output:

729
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8 9
...

result:

ok 729 queen(s)

Test #50:

score: 0
Accepted
time: 210ms
memory: 5872kb

input:

408

output:

166462
1 2
2 4
1 3
2 1
2 2
3 4
1 4
3 1
3 2
3 3
4 1
4 3
4 2
4 4
5 1
6 1
1 6
1 5
5 2
6 2
2 5
2 6
5 3
6 3
3 5
3 6
4 6
4 5
5 6
5 4
6 4
5 5
6 5
6 6
7 1
8 1
1 8
1 7
7 2
8 2
2 7
2 8
7 3
8 3
3 7
3 8
7 4
8 4
4 8
4 7
8 5
7 5
5 7
5 8
6 8
6 7
7 8
7 6
8 6
7 7
8 7
8 8
9 1
10 1
1 10
1 9
9 2
10 2
2 9
2 10
9 3
10 3
...

result:

ok 166462 queen(s)

Test #51:

score: -55
Time Limit Exceeded

input:

747

output:

558009
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
7 1
6 1
1 6
1 7
6 2
7 2
2 7
2 6
7 3
6 3
3 6
3 7
6 4
7 4
4 7
4 6
6 7
5 6
7 6
6 6
5 7
7 5
6 5
7 7
9 1
8 1
1 8
1 9
8 2
9 2
2 9
2 8
9 3
8 3
3 8
3 9
8 4
9 4
4 9
4 8
9 5
8 5
5 8
5 9
8 6
9 6
6 9
6 8
8...

result: