QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#81968#5575. Knight's Tour ReduxupsolveupsolveAC ✓17ms4064kbC++202.4kb2023-02-26 19:34:182023-02-26 19:35:55

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 19:35:55]
  • 评测
  • 测评结果:AC
  • 用时:17ms
  • 内存:4064kb
  • [2023-02-26 19:34:18]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;

vector<int> dh={-3,-1,1,3,3,1,-1,-3},dw={1,3,3,1,-1,-3,-3,-1};
/*
bool useh[13],usew[13];
int N;
vector<int> D;

void DFS(int h,int w,int t){
    if(h<0||h>=N||w<0||w>=N) return;
    if(useh[h]||usew[w]) return;
    useh[h]=true;
    usew[w]=true;
    if(t==N-1){
        for(int x:D) cout<<x<<",";
        cout<<endl;
        return;
    }
    
    for(int k=0;k<8;k++){
        D.push_back(k);
        DFS(h+dh[k],w+dw[k],t+1);
        D.pop_back();
    }
    
    useh[h]=false;
    usew[w]=false;
}
*/
int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /*
    for(N=5;N<=10;N++){
        memset(useh,0,sizeof(useh));
        memset(usew,0,sizeof(usew));
        D.clear();
        DFS(0,2,0);
    }
    */
    vector<vector<int>> base;
    base.push_back({3,5,0,2});
    base.push_back({2,4,5,7,2});
    base.push_back({2,3,5,0,5,4});
    base.push_back({2,3,3,6,6,7,2});
    base.push_back({2,2,4,4,6,0,6,4});
    base.push_back({2,2,3,5,3,6,6,7,1});
    
    vector<int> mov={3,5,0,2,3,2};
    
    int N;cin>>N;
    if(N==1){
        cout<<"POSSIBLE\n";
        cout<<"1 1\n";
        return 0;
    }
    if(N<=4){
        cout<<"IMPOSSIBLE\n";
        return 0;
    }
    
    int type=(N-5)%6,syo=(N-5)/6;
    int h=0,w=2;
    vector<pair<int,int>> ans;
    for(int t=0;t<syo;t++){
        for(int k:mov){
            ans.push_back(mp(h,w));
            h+=dh[k];
            w+=dw[k];
        }
    }
    
    for(int k:base[type]){
        ans.push_back(mp(h,w));
        h+=dh[k];
        w+=dw[k];
    }
    
    ans.push_back(mp(h,w));
    
    for(int i=0;i+1<si(ans);i++){
        int h=abs(ans[i+1].fi-ans[i].fi),w=abs(ans[i+1].se-ans[i].se);
        if(h>w) swap(h,w);
        assert(h==1&&w==3);
    }
    
    cout<<"POSSIBLE\n";
    
    for(auto [a,b]:ans) cout<<a+1<<" "<<b+1<<"\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3336kb

input:

1

output:

POSSIBLE
1 1

result:

ok answer = 1

Test #2:

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

input:

2

output:

IMPOSSIBLE

result:

ok answer = 0

Test #3:

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

input:

3

output:

IMPOSSIBLE

result:

ok answer = 0

Test #4:

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

input:

4

output:

IMPOSSIBLE

result:

ok answer = 0

Test #5:

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

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

input:

6

output:

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

result:

ok answer = 1

Test #7:

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

input:

7

output:

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

result:

ok answer = 1

Test #8:

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

input:

8

output:

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

result:

ok answer = 1

Test #9:

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

input:

9

output:

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

result:

ok answer = 1

Test #10:

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

input:

10

output:

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

result:

ok answer = 1

Test #11:

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

input:

11

output:

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

result:

ok answer = 1

Test #12:

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

input:

12

output:

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

result:

ok answer = 1

Test #13:

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

input:

13

output:

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

result:

ok answer = 1

Test #14:

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

input:

14

output:

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

result:

ok answer = 1

Test #15:

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

input:

15

output:

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

result:

ok answer = 1

Test #16:

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

input:

16

output:

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

result:

ok answer = 1

Test #17:

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

input:

17

output:

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

result:

ok answer = 1

Test #18:

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

input:

18

output:

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

result:

ok answer = 1

Test #19:

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

input:

19

output:

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

result:

ok answer = 1

Test #20:

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

input:

20

output:

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

result:

ok answer = 1

Test #21:

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

input:

99990

output:

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

result:

ok answer = 1

Test #22:

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

input:

99991

output:

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

result:

ok answer = 1

Test #23:

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

input:

99992

output:

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

result:

ok answer = 1

Test #24:

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

input:

99993

output:

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

result:

ok answer = 1

Test #25:

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

input:

99994

output:

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

result:

ok answer = 1

Test #26:

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

input:

99995

output:

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

result:

ok answer = 1

Test #27:

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

input:

99996

output:

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

result:

ok answer = 1

Test #28:

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

input:

99997

output:

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

result:

ok answer = 1

Test #29:

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

input:

99998

output:

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

result:

ok answer = 1

Test #30:

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

input:

99999

output:

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

result:

ok answer = 1

Test #31:

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

input:

100000

output:

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

result:

ok answer = 1

Test #32:

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

input:

74615

output:

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

result:

ok answer = 1

Test #33:

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

input:

25027

output:

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

result:

ok answer = 1

Test #34:

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

input:

40852

output:

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

result:

ok answer = 1

Test #35:

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

input:

31411

output:

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

result:

ok answer = 1

Test #36:

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

input:

37332

output:

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

result:

ok answer = 1

Test #37:

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

input:

80435

output:

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

result:

ok answer = 1

Test #38:

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

input:

90457

output:

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

result:

ok answer = 1

Test #39:

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

input:

1796

output:

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

result:

ok answer = 1

Test #40:

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

input:

55809

output:

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

result:

ok answer = 1

Test #41:

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

input:

97013

output:

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

result:

ok answer = 1

Test #42:

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

input:

77938

output:

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

result:

ok answer = 1

Test #43:

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

input:

87884

output:

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

result:

ok answer = 1

Test #44:

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

input:

61687

output:

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

result:

ok answer = 1

Test #45:

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

input:

32567

output:

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

result:

ok answer = 1

Test #46:

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

input:

53441

output:

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

result:

ok answer = 1

Test #47:

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

input:

19197

output:

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

result:

ok answer = 1

Test #48:

score: 0
Accepted
time: 15ms
memory: 4064kb

input:

77260

output:

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

result:

ok answer = 1

Test #49:

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

input:

6699

output:

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

result:

ok answer = 1

Test #50:

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

input:

72561

output:

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

result:

ok answer = 1

Test #51:

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

input:

60412

output:

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

result:

ok answer = 1

Test #52:

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

input:

78243

output:

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

result:

ok answer = 1

Test #53:

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

input:

93055

output:

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

result:

ok answer = 1

Test #54:

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

input:

72060

output:

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

result:

ok answer = 1

Test #55:

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

input:

10561

output:

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

result:

ok answer = 1

Test #56:

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

input:

56368

output:

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

result:

ok answer = 1

Test #57:

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

input:

44898

output:

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

result:

ok answer = 1

Test #58:

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

input:

69941

output:

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

result:

ok answer = 1

Test #59:

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

input:

24192

output:

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

result:

ok answer = 1

Test #60:

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

input:

13677

output:

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

result:

ok answer = 1

Test #61:

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

input:

47780

output:

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

result:

ok answer = 1

Test #62:

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

input:

36022

output:

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

result:

ok answer = 1

Test #63:

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

input:

50675

output:

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

result:

ok answer = 1

Test #64:

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

input:

26644

output:

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

result:

ok answer = 1

Test #65:

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

input:

56969

output:

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

result:

ok answer = 1

Test #66:

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

input:

53401

output:

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

result:

ok answer = 1

Test #67:

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

input:

24772

output:

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

result:

ok answer = 1

Test #68:

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

input:

35433

output:

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

result:

ok answer = 1

Test #69:

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

input:

89877

output:

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

result:

ok answer = 1

Test #70:

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

input:

99986

output:

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

result:

ok answer = 1

Test #71:

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

input:

6094

output:

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

result:

ok answer = 1