QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#82574#5575. Knight's Tour ReduxNYCU_YamadaAC ✓19ms5256kbC++203.6kb2023-02-28 06:56:152023-02-28 06:56:42

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-28 06:56:42]
  • Judged
  • Verdict: AC
  • Time: 19ms
  • Memory: 5256kb
  • [2023-02-28 06:56:15]
  • Submitted

answer

#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize ("unroll-loops", "Ofast")
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define double __float80
using pii = pair<int,int>;
template <typename T> using MaxHeap = priority_queue<T>;
template <typename T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

#define SZ(a) (int)((a).size())
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define X first
#define Y second

template <size_t D, typename T> struct Vec : vector<Vec<D-1, T>> {
    template <typename ... U> Vec(int n = 0, U ... _u) : vector<Vec<D-1, T>>(n, Vec<D-1, T>(_u...)) {}
};
template <typename T> struct Vec<1, T> : vector<T> {
    Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {}
};

#ifdef local
#define debug(...) \
    fprintf(stderr, "\e[1;93mAt [%s], Line %d: (%s) = ", __FUNCTION__, __LINE__, #__VA_ARGS__), \
    _do(__VA_ARGS__), \
    fprintf(stderr, "\e[0m")
template <typename T> void _do(T &&_x) {cerr << _x << endl;}
template <typename T, typename ...S> void _do(T &&_x, S &&..._t) {cerr << _x << ", "; _do(_t...);}
#define IOS() void()
#else
#define IOS() ios_base::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define debug(...) void()
#endif

template <typename U, typename V> bool chmin(U &lhs, V rhs) {return lhs > rhs ? lhs = rhs, 1 : 0;}
template <typename U, typename V> bool chmax(U &lhs, V rhs) {return lhs < rhs ? lhs = rhs, 1 : 0;}

const vector<pii> vec[11] = {
    {{1, 1}, {2, 4}, {3, 7}, {6, 8}, {5, 5}, {4, 2}, {7, 3}, {8, 6}}, 
    {{1, 1}, {2, 4}, {3, 7}, {6, 8}, {5, 5}, {4, 2}, {7, 3}, {8, 6}, {9, 9}},
    {{1, 1}, {2, 4}, {3, 7}, {4, 10}, {7, 9}, {6, 6}, {5, 3}, {8, 2}, {9, 5}, {10, 8}},
    {{1, 1}, {2, 4}, {3, 7}, {4, 10}, {7, 9}, {6, 6}, {5, 3}, {8, 2}, {9, 5}, {10, 8}, {11, 11}},
    {{1, 1}, {2, 4}, {5, 5}, {4, 8}, {3, 11}, {6, 12}, {7, 9}, {10, 10}, {9, 7}, {12, 6}, {11, 3}, {8, 2}},
    {{1, 3}, {4, 4}, {5, 1}, {2, 2}, {3, 5}},
    {{1, 1}, {2, 4}, {5, 3}, {6, 6}, {3, 5}, {4, 2}},
    {{1, 1}, {2, 4}, {3, 7}, {6, 6}, {7, 3}, {4, 2}, {5, 5}}
};

void solve() {
    int n; cin >> n;
    if (n == 1) {
        cout << "POSSIBLE" << endl;
        cout << 1 << ' ' << 1 << endl;
        return void();
    }
    if (n <= 4) return cout << "IMPOSSIBLE" << endl, void();
    
    cout << "POSSIBLE" << endl;
    
    vector<pii> ans;
    if (n % 8 == 5) {
        for (int i = 0; i < 5; ++i) {
            ans.eb(vec[5][i].X, vec[5][i].Y);
        }
    }
    int cur = 5 * (n % 8 == 5);
    for (int i = 0; i < n / 8 - (n % 8 <= 4); ++i) {
        for (int j = 0; j < 8; ++j) {
            ans.eb(vec[0][j].X + cur, vec[0][j].Y + cur);
        }
        cur += 8;
    }
    
    if (n % 8 != 5) {
        for (auto [dx, dy] : vec[n%8]) {
            ans.eb(dx + cur, dy + cur);
        }
    }
    
    // assert(SZ(ans) == n);
    // vector<int> chkx(n+1), chky(n+1);
    // for (int i = 0; i < n-1; ++i) {
        // assert((set<int>{abs(ans[i].X - ans[i+1].X), abs(ans[i].Y - ans[i+1].Y)}) == (set<int>{1, 3}));
        // assert(chkx[ans[i].X]++ == 0);
        // assert(chky[ans[i].Y]++ == 0);
    // }
    // assert(chkx[0] == 0);
    // assert(chky[0] == 0);
    // assert(chkx[ans[n-1].X]++ == 0);
    // assert(chky[ans[n-1].Y]++ == 0);
    
    for (int i = 0; i < n; ++i) {
        cout << ans[i].X << ' ' << ans[i].Y << endl; 
    }
}

signed main(){
    IOS();
    int t = 1; // cin >> t;
    for (int i = 1; i <= t; ++i) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

POSSIBLE
1 1

result:

ok answer = 1

Test #2:

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

input:

2

output:

IMPOSSIBLE

result:

ok answer = 0

Test #3:

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

input:

3

output:

IMPOSSIBLE

result:

ok answer = 0

Test #4:

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

input:

4

output:

IMPOSSIBLE

result:

ok answer = 0

Test #5:

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

input:

5

output:

POSSIBLE
1 3
4 4
5 1
2 2
3 5

result:

ok answer = 1

Test #6:

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

input:

6

output:

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

result:

ok answer = 1

Test #7:

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

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

input:

8

output:

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

result:

ok answer = 1

Test #9:

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

input:

9

output:

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

result:

ok answer = 1

Test #10:

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

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

input:

11

output:

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

result:

ok answer = 1

Test #12:

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

input:

12

output:

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

result:

ok answer = 1

Test #13:

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

input:

13

output:

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

result:

ok answer = 1

Test #14:

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

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 11
14 14
11 13
12 10

result:

ok answer = 1

Test #15:

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

input:

15

output:

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

result:

ok answer = 1

Test #16:

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

input:

16

output:

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

result:

ok answer = 1

Test #17:

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

input:

17

output:

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

result:

ok answer = 1

Test #18:

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

input:

18

output:

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

result:

ok answer = 1

Test #19:

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

input:

19

output:

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

result:

ok answer = 1

Test #20:

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

input:

20

output:

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

result:

ok answer = 1

Test #21:

score: 0
Accepted
time: 18ms
memory: 5104kb

input:

99990

output:

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

result:

ok answer = 1

Test #22:

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

input:

99991

output:

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

result:

ok answer = 1

Test #23:

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

input:

99992

output:

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

result:

ok answer = 1

Test #24:

score: 0
Accepted
time: 18ms
memory: 5120kb

input:

99993

output:

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

result:

ok answer = 1

Test #25:

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

input:

99994

output:

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

result:

ok answer = 1

Test #26:

score: 0
Accepted
time: 18ms
memory: 5196kb

input:

99995

output:

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

result:

ok answer = 1

Test #27:

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

input:

99996

output:

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

result:

ok answer = 1

Test #28:

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

input:

99997

output:

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

result:

ok answer = 1

Test #29:

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

input:

99998

output:

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

result:

ok answer = 1

Test #30:

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

input:

99999

output:

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

result:

ok answer = 1

Test #31:

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

input:

100000

output:

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

result:

ok answer = 1

Test #32:

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

input:

74615

output:

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

result:

ok answer = 1

Test #33:

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

input:

25027

output:

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

result:

ok answer = 1

Test #34:

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

input:

40852

output:

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

result:

ok answer = 1

Test #35:

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

input:

31411

output:

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

result:

ok answer = 1

Test #36:

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

input:

37332

output:

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

result:

ok answer = 1

Test #37:

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

input:

80435

output:

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

result:

ok answer = 1

Test #38:

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

input:

90457

output:

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

result:

ok answer = 1

Test #39:

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

input:

1796

output:

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

result:

ok answer = 1

Test #40:

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

input:

55809

output:

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

result:

ok answer = 1

Test #41:

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

input:

97013

output:

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

result:

ok answer = 1

Test #42:

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

input:

77938

output:

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

result:

ok answer = 1

Test #43:

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

input:

87884

output:

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

result:

ok answer = 1

Test #44:

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

input:

61687

output:

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

result:

ok answer = 1

Test #45:

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

input:

32567

output:

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

result:

ok answer = 1

Test #46:

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

input:

53441

output:

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

result:

ok answer = 1

Test #47:

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

input:

19197

output:

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

result:

ok answer = 1

Test #48:

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

input:

77260

output:

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

result:

ok answer = 1

Test #49:

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

input:

6699

output:

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

result:

ok answer = 1

Test #50:

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

input:

72561

output:

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

result:

ok answer = 1

Test #51:

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

input:

60412

output:

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

result:

ok answer = 1

Test #52:

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

input:

78243

output:

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

result:

ok answer = 1

Test #53:

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

input:

93055

output:

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

result:

ok answer = 1

Test #54:

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

input:

72060

output:

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

result:

ok answer = 1

Test #55:

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

input:

10561

output:

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

result:

ok answer = 1

Test #56:

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

input:

56368

output:

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

result:

ok answer = 1

Test #57:

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

input:

44898

output:

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

result:

ok answer = 1

Test #58:

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

input:

69941

output:

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

result:

ok answer = 1

Test #59:

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

input:

24192

output:

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

result:

ok answer = 1

Test #60:

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

input:

13677

output:

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

result:

ok answer = 1

Test #61:

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

input:

47780

output:

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

result:

ok answer = 1

Test #62:

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

input:

36022

output:

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

result:

ok answer = 1

Test #63:

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

input:

50675

output:

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

result:

ok answer = 1

Test #64:

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

input:

26644

output:

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

result:

ok answer = 1

Test #65:

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

input:

56969

output:

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

result:

ok answer = 1

Test #66:

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

input:

53401

output:

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

result:

ok answer = 1

Test #67:

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

input:

24772

output:

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

result:

ok answer = 1

Test #68:

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

input:

35433

output:

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

result:

ok answer = 1

Test #69:

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

input:

89877

output:

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

result:

ok answer = 1

Test #70:

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

input:

99986

output:

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

result:

ok answer = 1

Test #71:

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

input:

6094

output:

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

result:

ok answer = 1