QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#81738#5575. Knight's Tour Reduxfeecle6418AC ✓55ms13592kbC++141.7kb2023-02-26 10:36:232023-02-26 10:38:27

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-26 10:38:27]
  • 评测
  • 测评结果:AC
  • 用时:55ms
  • 内存:13592kb
  • [2023-02-26 10:36:23]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
int n,nn,is1[150],is2[150],a[150],b[150],D;
int dx[]={1,3,1,3,-1,-3,-1,-3};
int dy[]={3,1,-3,-1,3,1,-3,-1};
int my[20][20]={
{0,0},
{1,1},
{2,4},
{3,7},
{4,10},
{7,9},
{6,6},
{5,3},
{8,2},
{9,5},
{10,8}
};
int A[100005],B[100005];
void dfs(int x,int y,int num){
	a[num]=x,b[num]=y;
	if(num==n){
		for(int i=1;i<=num;i++){
			cout<<a[i]+D<<' '<<b[i]+D<<'\n';
			A[++A[0]]=a[i]+D;
			B[A[0]]=b[i]+D;
		}
		assert(A[0]==nn);
		set<int> s1,s2;
		s1.insert(A[nn]),s2.insert(B[nn]);
		for(int i=1;i<nn;i++){
			bool ok=0;
			for(int j=0;j<8;j++){
				if(A[i]+dx[j]==A[i+1]&&B[i]+dy[j]==B[i+1])ok=1;
			}
			if(!ok)assert(0);
			s1.insert(A[i]),s2.insert(B[i]);
		}
		assert(s1.size()==nn&&s2.size()==nn);
		exit(0);
	}
	is1[x]=is2[y]=1;
	for(int i=0;i<8;i++){
		int nx=x+dx[i],ny=y+dy[i];
		if(nx<1||nx>n||ny<1||ny>n)continue;
		if(is1[nx]||is2[ny])continue;
		dfs(nx,ny,num+1);
	}
	is1[x]=is2[y]=0;
}
int main(){
	cin>>n,nn=n;
	if(n==2||n==3||n==4)return puts("IMPOSSIBLE"),0;
	puts("POSSIBLE");
	if(n==5){
		dfs(1,3,1);
	}
	if(n==1){
		dfs(1,1,1);
	}
	if(n%10>=6||n%10==0){
		for(int i=1;i<=n/10;i++){
			for(int j=1;j<=10;j++){
				cout<<my[j][0]+(i-1)*10<<' '<<my[j][1]+(i-1)*10<<'\n';
				A[++A[0]]=my[j][0]+(i-1)*10;
				B[A[0]]=my[j][1]+(i-1)*10;
			}
		}
		if(n%10==0)exit(0);
		D=n/10*10;
		n%=10;
		dfs(1,1,1);
	}
	else {
		for(int i=1;i<n/10;i++){
			for(int j=1;j<=10;j++){
				cout<<my[j][0]+(i-1)*10<<' '<<my[j][1]+(i-1)*10<<'\n';
				A[++A[0]]=my[j][0]+(i-1)*10;
				B[A[0]]=my[j][1]+(i-1)*10;
			}
		}
		if(n%10==0)exit(0);
		D=n/10*10-10;
		n-=D;
		dfs(1,1,1);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3476kb

input:

1

output:

POSSIBLE
1 1

result:

ok answer = 1

Test #2:

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

input:

2

output:

IMPOSSIBLE

result:

ok answer = 0

Test #3:

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

input:

3

output:

IMPOSSIBLE

result:

ok answer = 0

Test #4:

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

input:

4

output:

IMPOSSIBLE

result:

ok answer = 0

Test #5:

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

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

input:

6

output:

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

result:

ok answer = 1

Test #7:

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

input:

7

output:

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

result:

ok answer = 1

Test #8:

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

input:

8

output:

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

result:

ok answer = 1

Test #9:

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

input:

9

output:

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

result:

ok answer = 1

Test #10:

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

input:

10

output:

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

result:

ok answer = 1

Test #11:

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

input:

11

output:

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

result:

ok answer = 1

Test #12:

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

input:

12

output:

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

result:

ok answer = 1

Test #13:

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

input:

13

output:

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

result:

ok answer = 1

Test #14:

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

input:

14

output:

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

result:

ok answer = 1

Test #15:

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

input:

15

output:

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

result:

ok answer = 1

Test #16:

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

input:

16

output:

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

result:

ok answer = 1

Test #17:

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

input:

17

output:

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

result:

ok answer = 1

Test #18:

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

input:

18

output:

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

result:

ok answer = 1

Test #19:

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

input:

19

output:

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

result:

ok answer = 1

Test #20:

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

input:

20

output:

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

result:

ok answer = 1

Test #21:

score: 0
Accepted
time: 16ms
memory: 4208kb

input:

99990

output:

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

result:

ok answer = 1

Test #22:

score: 0
Accepted
time: 46ms
memory: 13552kb

input:

99991

output:

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

result:

ok answer = 1

Test #23:

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

input:

99992

output:

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

result:

ok answer = 1

Test #24:

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

input:

99993

output:

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

result:

ok answer = 1

Test #25:

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

input:

99994

output:

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

result:

ok answer = 1

Test #26:

score: 0
Accepted
time: 36ms
memory: 13520kb

input:

99995

output:

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

result:

ok answer = 1

Test #27:

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

input:

99996

output:

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

result:

ok answer = 1

Test #28:

score: 0
Accepted
time: 46ms
memory: 13548kb

input:

99997

output:

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

result:

ok answer = 1

Test #29:

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

input:

99998

output:

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

result:

ok answer = 1

Test #30:

score: 0
Accepted
time: 33ms
memory: 13520kb

input:

99999

output:

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

result:

ok answer = 1

Test #31:

score: 0
Accepted
time: 16ms
memory: 4176kb

input:

100000

output:

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

result:

ok answer = 1

Test #32:

score: 0
Accepted
time: 29ms
memory: 10956kb

input:

74615

output:

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

result:

ok answer = 1

Test #33:

score: 0
Accepted
time: 13ms
memory: 5972kb

input:

25027

output:

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

result:

ok answer = 1

Test #34:

score: 0
Accepted
time: 17ms
memory: 7588kb

input:

40852

output:

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

result:

ok answer = 1

Test #35:

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

input:

31411

output:

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

result:

ok answer = 1

Test #36:

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

input:

37332

output:

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

result:

ok answer = 1

Test #37:

score: 0
Accepted
time: 37ms
memory: 11608kb

input:

80435

output:

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

result:

ok answer = 1

Test #38:

score: 0
Accepted
time: 41ms
memory: 12604kb

input:

90457

output:

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

result:

ok answer = 1

Test #39:

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

input:

1796

output:

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

result:

ok answer = 1

Test #40:

score: 0
Accepted
time: 32ms
memory: 9068kb

input:

55809

output:

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

result:

ok answer = 1

Test #41:

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

input:

97013

output:

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

result:

ok answer = 1

Test #42:

score: 0
Accepted
time: 19ms
memory: 11388kb

input:

77938

output:

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

result:

ok answer = 1

Test #43:

score: 0
Accepted
time: 34ms
memory: 12428kb

input:

87884

output:

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

result:

ok answer = 1

Test #44:

score: 0
Accepted
time: 32ms
memory: 9632kb

input:

61687

output:

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

result:

ok answer = 1

Test #45:

score: 0
Accepted
time: 17ms
memory: 6792kb

input:

32567

output:

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

result:

ok answer = 1

Test #46:

score: 0
Accepted
time: 23ms
memory: 8908kb

input:

53441

output:

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

result:

ok answer = 1

Test #47:

score: 0
Accepted
time: 12ms
memory: 5448kb

input:

19197

output:

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

result:

ok answer = 1

Test #48:

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

input:

77260

output:

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

result:

ok answer = 1

Test #49:

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

input:

6699

output:

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

result:

ok answer = 1

Test #50:

score: 0
Accepted
time: 41ms
memory: 10792kb

input:

72561

output:

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

result:

ok answer = 1

Test #51:

score: 0
Accepted
time: 20ms
memory: 9612kb

input:

60412

output:

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

result:

ok answer = 1

Test #52:

score: 0
Accepted
time: 33ms
memory: 11356kb

input:

78243

output:

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

result:

ok answer = 1

Test #53:

score: 0
Accepted
time: 40ms
memory: 12868kb

input:

93055

output:

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

result:

ok answer = 1

Test #54:

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

input:

72060

output:

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

result:

ok answer = 1

Test #55:

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

input:

10561

output:

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

result:

ok answer = 1

Test #56:

score: 0
Accepted
time: 22ms
memory: 9104kb

input:

56368

output:

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

result:

ok answer = 1

Test #57:

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

input:

44898

output:

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

result:

ok answer = 1

Test #58:

score: 0
Accepted
time: 34ms
memory: 10500kb

input:

69941

output:

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

result:

ok answer = 1

Test #59:

score: 0
Accepted
time: 13ms
memory: 5956kb

input:

24192

output:

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

result:

ok answer = 1

Test #60:

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

input:

13677

output:

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

result:

ok answer = 1

Test #61:

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

input:

47780

output:

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

result:

ok answer = 1

Test #62:

score: 0
Accepted
time: 20ms
memory: 7028kb

input:

36022

output:

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

result:

ok answer = 1

Test #63:

score: 0
Accepted
time: 19ms
memory: 8564kb

input:

50675

output:

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

result:

ok answer = 1

Test #64:

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

input:

26644

output:

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

result:

ok answer = 1

Test #65:

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

input:

56969

output:

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

result:

ok answer = 1

Test #66:

score: 0
Accepted
time: 17ms
memory: 8792kb

input:

53401

output:

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

result:

ok answer = 1

Test #67:

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

input:

24772

output:

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

result:

ok answer = 1

Test #68:

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

input:

35433

output:

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

result:

ok answer = 1

Test #69:

score: 0
Accepted
time: 37ms
memory: 12532kb

input:

89877

output:

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

result:

ok answer = 1

Test #70:

score: 0
Accepted
time: 46ms
memory: 13580kb

input:

99986

output:

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

result:

ok answer = 1

Test #71:

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

input:

6094

output:

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

result:

ok answer = 1