QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#338196#5575. Knight's Tour Reduxucup-team1198#AC ✓11ms5176kbC++202.7kb2024-02-25 18:57:012024-02-25 18:57:01

Judging History

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

  • [2024-02-25 18:57:01]
  • 评测
  • 测评结果:AC
  • 用时:11ms
  • 内存:5176kb
  • [2024-02-25 18:57:01]
  • 提交

answer

#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;

vector<array<int, 2>> get0 = {},
                      get1 = {{0, 0}},
                      get8 = {{0, 0}, {1, 3}, {2, 6}, {5, 7}, {6, 4}, {3, 5}, {4, 2}, {7, 1}},
                      get10= {{0, 0}, {3, 1}, {6, 2}, {9, 3}, {8, 6}, {7, 9}, {4, 8}, {1, 7}, {2, 4}, {5, 5}},
                      get5 = {{2, 0}, {3, 3}, {0, 4}, {1, 1}, {4, 2}};

void print(vector<array<int, 2>> a) {
    /// set<int> xs, ys;
    for (auto elem : a) {
        cout << elem[0] + 1 << " " << elem[1] + 1 << "\n";
        /// xs.insert(elem[0]);
        /// ys.insert(elem[1]);
    }
    /**assert(xs.size() == a.size() && ys.size() == a.size());
    for (int i = 1; i < (int)a.size(); ++i) {
        int dx = abs(a[i][0] - a[i - 1][0]);
        int dy = abs(a[i][1] - a[i - 1][1]);
        assert(min(dx, dy) == 1 && max(dx, dy) == 3);
    }*/
}

void solve(vector<array<int, 2>> s, vector<array<int, 2>> t, int k) {
    vector<array<int, 2>> res;
    reverse(s.begin(), s.end());
    for (auto& elem : s) {
        elem[0] = s.size() - 1 - elem[0];
        elem[1] = s.size() - 1 - elem[1];
    }
    int d = 0;

    auto add = [&](vector<array<int, 2>> a) {
        for (auto elem : a) {
            res.push_back({elem[0] + d, elem[1] + d});
        }
        d += a.size();
    };

    add(s);
    if (k == -1) {
        res.pop_back();
        --d;
    }
    for (int i = 0; i < k; ++i) {
        add(get5);
        add(get1);
    }
    if (k >= 0) {
        add(get5);
    }
    add(t);
    print(res);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int n;
    cin >> n;
    if (n == 2 || n == 3 || n == 4) {
        cout << "IMPOSSIBLE\n";
        return 0;
    }
    cout << "POSSIBLE\n";
    if (n == 9) {
        for (int i = 1; i <= 9; ++i) {
            cout << get10[i][0] << " " << get10[i][1] << "\n";
        }
        return 0;
    }
    int r = n % 6;
    if (r == 0) {
        solve(get0, get1, (n - 6) / 6);
    } else if (r == 1) {
        solve(get1, get1, (n - 7) / 6);
    } else if (r == 2) {
        solve(get1, get8, (n - 14) / 6);
    } else if (r == 3) {
        solve(get0, get10, (n - 15) / 6);
    } else if (r == 4) {
        solve(get1, get10, (n - 16) / 6);
    } else {
        solve(get0, get0, (n - 5) / 6);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

POSSIBLE
1 1

result:

ok answer = 1

Test #2:

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

input:

2

output:

IMPOSSIBLE

result:

ok answer = 0

Test #3:

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

input:

3

output:

IMPOSSIBLE

result:

ok answer = 0

Test #4:

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

input:

4

output:

IMPOSSIBLE

result:

ok answer = 0

Test #5:

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

input:

5

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3

result:

ok answer = 1

Test #6:

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

input:

6

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6

result:

ok answer = 1

Test #7:

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

input:

7

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7

result:

ok answer = 1

Test #8:

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

input:

8

output:

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

result:

ok answer = 1

Test #9:

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

input:

9

output:

POSSIBLE
3 1
6 2
9 3
8 6
7 9
4 8
1 7
2 4
5 5

result:

ok answer = 1

Test #10:

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

input:

10

output:

POSSIBLE
1 1
4 2
7 3
10 4
9 7
8 10
5 9
2 8
3 5
6 6

result:

ok answer = 1

Test #11:

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

input:

11

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9

result:

ok answer = 1

Test #12:

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

input:

12

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12

result:

ok answer = 1

Test #13:

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

input:

13

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13

result:

ok answer = 1

Test #14:

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

input:

14

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
8 10
9 13
12 14
13 11
10 12
11 9
14 8

result:

ok answer = 1

Test #15:

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

input:

15

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
12 8
15 9
14 12
13 15
10 14
7 13
8 10
11 11

result:

ok answer = 1

Test #16:

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

input:

16

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
13 9
16 10
15 13
14 16
11 15
8 14
9 11
12 12

result:

ok answer = 1

Test #17:

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

input:

17

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15

result:

ok answer = 1

Test #18:

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

input:

18

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18

result:

ok answer = 1

Test #19:

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

input:

19

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19

result:

ok answer = 1

Test #20:

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

input:

20

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
14 16
15 19
18 20
19 17
16 18
17 15
20 14

result:

ok answer = 1

Test #21:

score: 0
Accepted
time: 10ms
memory: 5056kb

input:

99990

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #22:

score: 0
Accepted
time: 10ms
memory: 5176kb

input:

99991

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #23:

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

input:

99992

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #24:

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

input:

99993

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #25:

score: 0
Accepted
time: 7ms
memory: 5068kb

input:

99994

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #26:

score: 0
Accepted
time: 5ms
memory: 4980kb

input:

99995

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #27:

score: 0
Accepted
time: 5ms
memory: 4964kb

input:

99996

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #28:

score: 0
Accepted
time: 10ms
memory: 5004kb

input:

99997

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #29:

score: 0
Accepted
time: 10ms
memory: 5008kb

input:

99998

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #30:

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

input:

99999

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #31:

score: 0
Accepted
time: 5ms
memory: 4972kb

input:

100000

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #32:

score: 0
Accepted
time: 8ms
memory: 4436kb

input:

74615

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #33:

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

input:

25027

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #34:

score: 0
Accepted
time: 5ms
memory: 3952kb

input:

40852

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #35:

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

input:

31411

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #36:

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

input:

37332

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #37:

score: 0
Accepted
time: 5ms
memory: 4504kb

input:

80435

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #38:

score: 0
Accepted
time: 9ms
memory: 4860kb

input:

90457

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #39:

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

input:

1796

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #40:

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

input:

55809

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #41:

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

input:

97013

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #42:

score: 0
Accepted
time: 8ms
memory: 4436kb

input:

77938

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #43:

score: 0
Accepted
time: 9ms
memory: 4876kb

input:

87884

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #44:

score: 0
Accepted
time: 7ms
memory: 4396kb

input:

61687

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #45:

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

input:

32567

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #46:

score: 0
Accepted
time: 6ms
memory: 4388kb

input:

53441

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #47:

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

input:

19197

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #48:

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

input:

77260

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #49:

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

input:

6699

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #50:

score: 0
Accepted
time: 8ms
memory: 4596kb

input:

72561

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #51:

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

input:

60412

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #52:

score: 0
Accepted
time: 8ms
memory: 4476kb

input:

78243

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #53:

score: 0
Accepted
time: 6ms
memory: 4736kb

input:

93055

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #54:

score: 0
Accepted
time: 8ms
memory: 4428kb

input:

72060

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #55:

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

input:

10561

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #56:

score: 0
Accepted
time: 6ms
memory: 4196kb

input:

56368

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #57:

score: 0
Accepted
time: 5ms
memory: 3924kb

input:

44898

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #58:

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

input:

69941

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #59:

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

input:

24192

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #60:

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

input:

13677

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #61:

score: 0
Accepted
time: 5ms
memory: 3972kb

input:

47780

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #62:

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

input:

36022

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #63:

score: 0
Accepted
time: 5ms
memory: 4268kb

input:

50675

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #64:

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

input:

26644

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #65:

score: 0
Accepted
time: 6ms
memory: 4236kb

input:

56969

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #66:

score: 0
Accepted
time: 6ms
memory: 4248kb

input:

53401

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #67:

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

input:

24772

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #68:

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

input:

35433

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #69:

score: 0
Accepted
time: 9ms
memory: 4700kb

input:

89877

output:

POSSIBLE
3 1
4 4
1 5
2 2
5 3
6 6
9 7
10 10
7 11
8 8
11 9
12 12
15 13
16 16
13 17
14 14
17 15
18 18
21 19
22 22
19 23
20 20
23 21
24 24
27 25
28 28
25 29
26 26
29 27
30 30
33 31
34 34
31 35
32 32
35 33
36 36
39 37
40 40
37 41
38 38
41 39
42 42
45 43
46 46
43 47
44 44
47 45
48 48
51 49
52 52
49 53
50 ...

result:

ok answer = 1

Test #70:

score: 0
Accepted
time: 10ms
memory: 5024kb

input:

99986

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1

Test #71:

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

input:

6094

output:

POSSIBLE
1 1
4 2
5 5
2 6
3 3
6 4
7 7
10 8
11 11
8 12
9 9
12 10
13 13
16 14
17 17
14 18
15 15
18 16
19 19
22 20
23 23
20 24
21 21
24 22
25 25
28 26
29 29
26 30
27 27
30 28
31 31
34 32
35 35
32 36
33 33
36 34
37 37
40 38
41 41
38 42
39 39
42 40
43 43
46 44
47 47
44 48
45 45
48 46
49 49
52 50
53 53
50 ...

result:

ok answer = 1