QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#553769#5575. Knight's Tour Redux251SecAC ✓8ms3952kbC++141.2kb2024-09-08 19:59:542024-09-08 19:59:55

Judging History

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

  • [2024-09-08 19:59:55]
  • 评测
  • 测评结果:AC
  • 用时:8ms
  • 内存:3952kb
  • [2024-09-08 19:59:54]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool vx[100], vy[100];
pair<int, int> st[100];
pair<int, int> d[6] = {
	{ 0, 0 }, { 3, 1 }, { 4, 4 }, { 1, 5 }, { 2, 2 }, { 5, 3 }
};
int top;
void DFS(int x, int y, int off, int N) {
	st[++top] = { x, y };
	if (top == N) {
		for (int i = 1; i <= top; i++) {
			printf("%d %d\n", st[i].first + off, st[i].second + off);
		}
		exit(0);
	}
	vx[x] = vy[y] = true;
	int dx[] = { 3, 3, -3, -3, 1, 1, -1, -1 };
	int dy[] = { 1, -1, 1, -1, 3, -3, 3, -3 };
	for (int d = 0; d < 8; d++) {
		int nx = x + dx[d], ny = y + dy[d];
		if (nx < 0 || nx >= N || ny < 0 || ny >= N || vx[nx] || vy[ny]) continue;
		DFS(nx, ny, off, N);
	}
	vx[x] = vy[y] = false;
	top--;
}
void Sol(int n, int off) {
	if (n > 12) {
		for (int i = 0; i < 6; i++) printf("%d %d\n", d[i].first + off, d[i].second + off);
		Sol(n - 6, off + 6);
	}
	else DFS(0, 0, off, n);
}
int n;
int main() {
	scanf("%d", &n);
	if (n <= 4 && n != 1) return puts("IMPOSSIBLE"), 0;
	puts("POSSIBLE");
	if (n <= 6) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				DFS(i, j, 1, n);
			}
		}
	}
	Sol(n, 1);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

POSSIBLE
1 1

result:

ok answer = 1

Test #2:

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

input:

2

output:

IMPOSSIBLE

result:

ok answer = 0

Test #3:

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

input:

3

output:

IMPOSSIBLE

result:

ok answer = 0

Test #4:

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

input:

4

output:

IMPOSSIBLE

result:

ok answer = 0

Test #5:

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

input:

5

output:

POSSIBLE
1 3
4 4
5 1
2 2
3 5

result:

ok answer = 1

Test #6:

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

input:

6

output:

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

result:

ok answer = 1

Test #7:

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

input:

7

output:

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

result:

ok answer = 1

Test #8:

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

input:

8

output:

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

result:

ok answer = 1

Test #9:

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

input:

9

output:

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

result:

ok answer = 1

Test #10:

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

input:

10

output:

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

result:

ok answer = 1

Test #11:

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

input:

11

output:

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

result:

ok answer = 1

Test #12:

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

input:

12

output:

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

result:

ok answer = 1

Test #13:

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

input:

13

output:

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

result:

ok answer = 1

Test #14:

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

input:

14

output:

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

result:

ok answer = 1

Test #15:

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

input:

15

output:

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

result:

ok answer = 1

Test #16:

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

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
12 12
9 11
8 14
11 15
14 16

result:

ok answer = 1

Test #17:

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

input:

17

output:

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

result:

ok answer = 1

Test #18:

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

input:

18

output:

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

result:

ok answer = 1

Test #19:

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

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
19 15
18 18
15 19
14 16
17 17

result:

ok answer = 1

Test #20:

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

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
16 14
19 15
20 18
17 19
14 20
15 17
18 16

result:

ok answer = 1

Test #21:

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

input:

99990

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

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

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: 8ms
memory: 3868kb

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: 5ms
memory: 3876kb

input:

99993

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

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

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: 8ms
memory: 3864kb

input:

99995

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

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

input:

99996

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

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

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: 8ms
memory: 3876kb

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: 8ms
memory: 3760kb

input:

99999

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

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

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: 3ms
memory: 3816kb

input:

74615

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

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

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: 3ms
memory: 3876kb

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: 3ms
memory: 3868kb

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: 3ms
memory: 3796kb

input:

37332

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

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

input:

80435

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

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

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: 0ms
memory: 3952kb

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: 5ms
memory: 3760kb

input:

55809

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

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

input:

97013

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

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

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: 3ms
memory: 3812kb

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: 5ms
memory: 3816kb

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: 3ms
memory: 3788kb

input:

32567

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

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

input:

53441

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

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

input:

19197

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

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

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

input:

6699

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

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

input:

72561

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

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

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: 6ms
memory: 3860kb

input:

78243

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

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

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: 6ms
memory: 3868kb

input:

72060

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

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

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: 5ms
memory: 3796kb

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: 4ms
memory: 3888kb

input:

44898

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

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

input:

69941

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

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

input:

24192

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

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

input:

13677

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

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

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: 3ms
memory: 3792kb

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: 2ms
memory: 3904kb

input:

50675

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

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

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: 5ms
memory: 3756kb

input:

56969

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

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

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: 2ms
memory: 3752kb

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: 3ms
memory: 3868kb

input:

35433

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

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

input:

89877

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

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

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

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