QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#142151#5575. Knight's Tour ReduxPhantom Threshold (Jiachen Tang, Changdong Li, Weinuo Li)#AC ✓12ms4312kbC++202.8kb2023-08-18 15:58:212023-08-18 15:58:22

Judging History

This is the latest submission verdict.

  • [2023-08-18 15:58:22]
  • Judged
  • Verdict: AC
  • Time: 12ms
  • Memory: 4312kb
  • [2023-08-18 15:58:21]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int MOD=998244353;
int main()
{
	ios_base::sync_with_stdio(false);
	long long n;
	cin>>n;
	if(n==1)
	{
		cout<<"POSSIBLE\n1 1\n";
	}
	else if(n<=4)
	{
		cout<<"IMPOSSIBLE\n";
	}
	else if(n<18)
	{
		cout<<"POSSIBLE\n";
		vector<int> vr(n+5),vc(n+5);
		vector<int> dx={1,3,3,1,-1,-3,-3,-1},dy={-3,-1,1,3,3,1,-1,-3};
		vector<pair<int,int>> sol;
		auto chk=[&](int x){return 1<=x and x<=n;};
		function<void(int,int,int)> dfs=[&](int x,int y,int dep)
		{
	//		cerr<<"dfs "<<x<<' '<<y<<' '<<dep<<endl;
			sol.emplace_back(x,y);
			if(dep==n)
			{
				for(auto [xx,yy]:sol)
					cout<<xx<<' '<<yy<<endl;
				exit(0);
			}
			vr[x]=1;vc[y]=1;
			for(int i=0;i<8;i++)
			{
				if(chk(x+dx[i]) and chk(y+dy[i]) and vr[x+dx[i]]==0 and vc[y+dy[i]]==0)
				{
					dfs(x+dx[i],y+dy[i],dep+1);
				}
			}
			vr[x]=0;vc[y]=0;
			sol.pop_back();
		};
		for(int i=1;i<=n;i++)
		{
			dfs(1,i,1);
		}
	}
	else if(n%2==1)
	{
		cout<<"POSSIBLE\n";
		int t=n%6;
		t+=6;
		int del=n-t;
		for(int i=1;i<=del;i+=6)
		{
			cout<<i<<' '<<i<<"\n";
			cout<<i+3<<' '<<i+1<<"\n";
			cout<<i+4<<' '<<i+4<<"\n";
			cout<<i+1<<' '<<i+5<<"\n";
			cout<<i+2<<' '<<i+2<<"\n";
			cout<<i+5<<' '<<i+3<<"\n";
		}
		vector<int> vr(n+5),vc(n+5);
		vector<int> dx={1,3,3,1,-1,-3,-3,-1},dy={-3,-1,1,3,3,1,-1,-3};
		vector<pair<int,int>> sol;
		auto chk=[&](int x){return 1<=x and x<=t;};
		function<void(int,int,int)> dfs=[&](int x,int y,int dep)
		{
	//		cerr<<"dfs "<<x<<' '<<y<<' '<<dep<<endl;
			sol.emplace_back(x,y);
			if(dep==t)
			{
				for(auto [xx,yy]:sol)
					cout<<xx+del<<' '<<yy+del<<endl;
				exit(0);
			}
			vr[x]=1;vc[y]=1;
			for(int i=0;i<8;i++)
			{
				if(chk(x+dx[i]) and chk(y+dy[i]) and vr[x+dx[i]]==0 and vc[y+dy[i]]==0)
				{
					dfs(x+dx[i],y+dy[i],dep+1);
				}
			}
			vr[x]=0;vc[y]=0;
			sol.pop_back();
		};
		dfs(1,1,1);
	}
	else if(n%4==2)
	{
		cout<<"POSSIBLE\n";
		cout<<1<<' '<<2<<endl;
		cout<<4<<' '<<1<<endl;
		cout<<5<<' '<<4<<endl;
		for(int i=8;i<=n;i+=4)
		{
			cout<<i<<' '<<i-5<<"\n";
			cout<<i+1<<' '<<i-2<<"\n";
		}
		cout<<n<<' '<<n-1<<endl;
		cout<<n-3<<' '<<n<<endl;
		cout<<n-4<<' '<<n-3<<endl;
		for(int i=n-7;i>=1;i-=4)
		{
			cout<<i<<' '<<i+5<<"\n";
			cout<<i-1<<' '<<i+2<<"\n";
		}
	}
	else //n%4==0
	{
		cout<<"POSSIBLE\n";
		cout<<1<<' '<<6<<endl;
		cout<<2<<' '<<3<<endl;
		cout<<5<<' '<<2<<endl;
		for(int i=8;i<n;i+=4)
		{
			cout<<i<<' '<<i-7<<"\n";
			cout<<i+1<<' '<<i-4<<"\n";
		}
		cout<<n<<' '<<n-7<<endl;
		cout<<n-1<<' '<<n-4<<endl;
		cout<<n-2<<' '<<n-1<<endl;
		cout<<n-5<<' '<<n<<endl;
		cout<<n-6<<' '<<n-3<<endl;
		for(int i=n-9;i>=7;i-=4)
		{
			cout<<i<<' '<<i+7<<"\n";
			cout<<i-1<<' '<<i+4<<"\n";
		}
		cout<<3<<' '<<10<<endl;
		cout<<4<<' '<<7<<endl;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

POSSIBLE
1 1

result:

ok answer = 1

Test #2:

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

input:

2

output:

IMPOSSIBLE

result:

ok answer = 0

Test #3:

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

input:

3

output:

IMPOSSIBLE

result:

ok answer = 0

Test #4:

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

input:

4

output:

IMPOSSIBLE

result:

ok answer = 0

Test #5:

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

input:

5

output:

POSSIBLE
1 3
4 2
5 5
2 4
3 1

result:

ok answer = 1

Test #6:

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

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: 1ms
memory: 3572kb

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: 1ms
memory: 3520kb

input:

8

output:

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

result:

ok answer = 1

Test #9:

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

input:

9

output:

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

result:

ok answer = 1

Test #10:

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

input:

10

output:

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

result:

ok answer = 1

Test #11:

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

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: 1ms
memory: 3544kb

input:

12

output:

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

result:

ok answer = 1

Test #13:

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

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: 1ms
memory: 3460kb

input:

14

output:

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

result:

ok answer = 1

Test #15:

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

input:

15

output:

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

result:

ok answer = 1

Test #16:

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

input:

16

output:

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

result:

ok answer = 1

Test #17:

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

input:

17

output:

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

result:

ok answer = 1

Test #18:

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

input:

18

output:

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

result:

ok answer = 1

Test #19:

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

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: 1ms
memory: 3416kb

input:

20

output:

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

result:

ok answer = 1

Test #21:

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

input:

99990

output:

POSSIBLE
1 2
4 1
5 4
8 3
9 6
12 7
13 10
16 11
17 14
20 15
21 18
24 19
25 22
28 23
29 26
32 27
33 30
36 31
37 34
40 35
41 38
44 39
45 42
48 43
49 46
52 47
53 50
56 51
57 54
60 55
61 58
64 59
65 62
68 63
69 66
72 67
73 70
76 71
77 74
80 75
81 78
84 79
85 82
88 83
89 86
92 87
93 90
96 91
97 94
100 95
1...

result:

ok answer = 1

Test #22:

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

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

input:

99992

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #24:

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

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: 11ms
memory: 3580kb

input:

99994

output:

POSSIBLE
1 2
4 1
5 4
8 3
9 6
12 7
13 10
16 11
17 14
20 15
21 18
24 19
25 22
28 23
29 26
32 27
33 30
36 31
37 34
40 35
41 38
44 39
45 42
48 43
49 46
52 47
53 50
56 51
57 54
60 55
61 58
64 59
65 62
68 63
69 66
72 67
73 70
76 71
77 74
80 75
81 78
84 79
85 82
88 83
89 86
92 87
93 90
96 91
97 94
100 95
1...

result:

ok answer = 1

Test #26:

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

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: 11ms
memory: 3588kb

input:

99996

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #28:

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

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

input:

99998

output:

POSSIBLE
1 2
4 1
5 4
8 3
9 6
12 7
13 10
16 11
17 14
20 15
21 18
24 19
25 22
28 23
29 26
32 27
33 30
36 31
37 34
40 35
41 38
44 39
45 42
48 43
49 46
52 47
53 50
56 51
57 54
60 55
61 58
64 59
65 62
68 63
69 66
72 67
73 70
76 71
77 74
80 75
81 78
84 79
85 82
88 83
89 86
92 87
93 90
96 91
97 94
100 95
1...

result:

ok answer = 1

Test #30:

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

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

input:

100000

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #32:

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

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

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

input:

40852

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #35:

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

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: 1ms
memory: 3532kb

input:

37332

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #37:

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

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: 10ms
memory: 4244kb

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

input:

1796

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #40:

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

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: 11ms
memory: 4312kb

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

input:

77938

output:

POSSIBLE
1 2
4 1
5 4
8 3
9 6
12 7
13 10
16 11
17 14
20 15
21 18
24 19
25 22
28 23
29 26
32 27
33 30
36 31
37 34
40 35
41 38
44 39
45 42
48 43
49 46
52 47
53 50
56 51
57 54
60 55
61 58
64 59
65 62
68 63
69 66
72 67
73 70
76 71
77 74
80 75
81 78
84 79
85 82
88 83
89 86
92 87
93 90
96 91
97 94
100 95
1...

result:

ok answer = 1

Test #43:

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

input:

87884

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #44:

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

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

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

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

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: 9ms
memory: 3524kb

input:

77260

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #49:

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

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

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

input:

60412

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #52:

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

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: 11ms
memory: 4212kb

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

input:

72060

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #55:

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

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: 1ms
memory: 3464kb

input:

56368

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #57:

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

input:

44898

output:

POSSIBLE
1 2
4 1
5 4
8 3
9 6
12 7
13 10
16 11
17 14
20 15
21 18
24 19
25 22
28 23
29 26
32 27
33 30
36 31
37 34
40 35
41 38
44 39
45 42
48 43
49 46
52 47
53 50
56 51
57 54
60 55
61 58
64 59
65 62
68 63
69 66
72 67
73 70
76 71
77 74
80 75
81 78
84 79
85 82
88 83
89 86
92 87
93 90
96 91
97 94
100 95
1...

result:

ok answer = 1

Test #58:

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

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

input:

24192

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #60:

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

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

input:

47780

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #62:

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

input:

36022

output:

POSSIBLE
1 2
4 1
5 4
8 3
9 6
12 7
13 10
16 11
17 14
20 15
21 18
24 19
25 22
28 23
29 26
32 27
33 30
36 31
37 34
40 35
41 38
44 39
45 42
48 43
49 46
52 47
53 50
56 51
57 54
60 55
61 58
64 59
65 62
68 63
69 66
72 67
73 70
76 71
77 74
80 75
81 78
84 79
85 82
88 83
89 86
92 87
93 90
96 91
97 94
100 95
1...

result:

ok answer = 1

Test #63:

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

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

input:

26644

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #65:

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

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

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

input:

24772

output:

POSSIBLE
1 6
2 3
5 2
8 1
9 4
12 5
13 8
16 9
17 12
20 13
21 16
24 17
25 20
28 21
29 24
32 25
33 28
36 29
37 32
40 33
41 36
44 37
45 40
48 41
49 44
52 45
53 48
56 49
57 52
60 53
61 56
64 57
65 60
68 61
69 64
72 65
73 68
76 69
77 72
80 73
81 76
84 77
85 80
88 81
89 84
92 85
93 88
96 89
97 92
100 93
101...

result:

ok answer = 1

Test #68:

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

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

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: 12ms
memory: 3464kb

input:

99986

output:

POSSIBLE
1 2
4 1
5 4
8 3
9 6
12 7
13 10
16 11
17 14
20 15
21 18
24 19
25 22
28 23
29 26
32 27
33 30
36 31
37 34
40 35
41 38
44 39
45 42
48 43
49 46
52 47
53 50
56 51
57 54
60 55
61 58
64 59
65 62
68 63
69 66
72 67
73 70
76 71
77 74
80 75
81 78
84 79
85 82
88 83
89 86
92 87
93 90
96 91
97 94
100 95
1...

result:

ok answer = 1

Test #71:

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

input:

6094

output:

POSSIBLE
1 2
4 1
5 4
8 3
9 6
12 7
13 10
16 11
17 14
20 15
21 18
24 19
25 22
28 23
29 26
32 27
33 30
36 31
37 34
40 35
41 38
44 39
45 42
48 43
49 46
52 47
53 50
56 51
57 54
60 55
61 58
64 59
65 62
68 63
69 66
72 67
73 70
76 71
77 74
80 75
81 78
84 79
85 82
88 83
89 86
92 87
93 90
96 91
97 94
100 95
1...

result:

ok answer = 1