QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#178023#7226. The Impressive Pathucup-team004TL 1ms3576kbC++201.3kb2023-09-13 17:22:302023-09-13 17:22:31

Judging History

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

  • [2023-09-13 17:22:31]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3576kb
  • [2023-09-13 17:22:30]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

constexpr int dx[] = {-2, -1, -2, 1, -1, 2, 1, 2};
constexpr int dy[] = {-1, -2, 1, -2, 2, -1, 2, 1};

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int n, m, t;
    std::cin >> n >> m >> t;
    
    std::vector vis(n, std::vector<bool>(m));
    std::vector<std::pair<int, int>> ans;
    auto dfs = [&](auto self, int x, int y, int t) -> void {
        vis[x][y] = true;
        if (n - 1 - x > 2 * t || m - 1 - y > 2 * t || n - 1 - x + m - 1 - y > 3 * t) {
            return;
        }
        if (x == n - 1 && y == m - 1) {
            if (t == 0) {
                for (auto [x, y] : ans) {
                    std::cout << x + 1 << " " << y + 1 << "\n";
                }
                std::exit(0);
            }
            return;
        }
        for (int k = 0; k < 8; k++) {
            int nx = x + dx[k];
            int ny = y + dy[k];
            if (0 <= nx && nx < n && 0 <= ny && ny < m && !vis[nx][ny]) {
                ans.emplace_back(nx, ny);
                self(self, nx, ny, t - 1);
                ans.pop_back();
            }
        }
        vis[x][y] = false;
    };
    dfs(dfs, 0, 0, t);
    
    return 0;
}

詳細信息

Test #1:

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

input:

8 8 16

output:

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

result:

ok correct

Test #2:

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

input:

8 8 32

output:

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

result:

ok correct

Test #3:

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

input:

8 8 48

output:

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

result:

ok correct

Test #4:

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

input:

9 8 17

output:

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

result:

ok correct

Test #5:

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

input:

9 8 35

output:

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

result:

ok correct

Test #6:

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

input:

9 8 53

output:

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

result:

ok correct

Test #7:

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

input:

10 8 18

output:

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

result:

ok correct

Test #8:

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

input:

10 8 38

output:

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

result:

ok correct

Test #9:

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

input:

8 10 58

output:

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

result:

ok correct

Test #10:

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

input:

8 10 60

output:

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

result:

ok correct

Test #11:

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

input:

11 8 19

output:

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

result:

ok correct

Test #12:

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

input:

8 11 41

output:

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

result:

ok correct

Test #13:

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

input:

11 8 63

output:

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

result:

ok correct

Test #14:

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

input:

11 8 65

output:

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

result:

ok correct

Test #15:

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

input:

8 12 20

output:

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

result:

ok correct

Test #16:

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

input:

8 12 44

output:

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

result:

ok correct

Test #17:

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

input:

8 12 68

output:

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

result:

ok correct

Test #18:

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

input:

8 12 72

output:

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

result:

ok correct

Test #19:

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

input:

13 8 21

output:

2 3
3 1
1 2
2 4
3 2
1 3
2 1
3 3
1 4
2 2
4 1
5 3
3 4
1 5
2 7
3 5
5 4
7 5
9 6
11 7
13 8

result:

ok correct

Test #20:

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

input:

13 8 47

output:

2 3
3 1
1 2
2 4
3 2
1 3
2 1
3 3
1 4
2 2
4 1
5 3
3 4
1 5
2 7
3 5
1 6
2 8
3 6
1 7
2 5
4 4
5 2
7 1
6 3
4 2
6 1
7 3
5 4
6 2
4 3
5 1
7 2
6 4
4 5
2 6
1 8
3 7
5 6
4 8
6 7
4 6
6 5
8 4
9 6
11 7
13 8

result:

ok correct

Test #21:

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

input:

8 13 73

output:

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

result:

ok correct

Test #22:

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

input:

8 13 77

output:

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

result:

ok correct

Test #23:

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

input:

8 14 22

output:

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

result:

ok correct

Test #24:

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

input:

8 14 50

output:

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

result:

ok correct

Test #25:

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

input:

14 8 78

output:

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

result:

ok correct

Test #26:

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

input:

8 14 84

output:

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

result:

ok correct

Test #27:

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

input:

8 15 23

output:

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

result:

ok correct

Test #28:

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

input:

15 8 53

output:

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

result:

ok correct

Test #29:

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

input:

15 8 83

output:

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

result:

ok correct

Test #30:

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

input:

8 15 89

output:

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

result:

ok correct

Test #31:

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

input:

8 16 24

output:

2 3
3 1
1 2
2 4
3 2
1 3
2 1
3 3
1 4
2 2
4 1
5 3
3 4
1 5
2 7
3 5
1 6
2 8
3 6
4 8
5 10
6 12
7 14
8 16

result:

ok correct

Test #32:

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

input:

16 8 56

output:

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

result:

ok correct

Test #33:

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

input:

16 8 88

output:

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

result:

ok correct

Test #34:

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

input:

8 16 96

output:

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

result:

ok correct

Test #35:

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

input:

9 9 18

output:

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

result:

ok correct

Test #36:

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

input:

9 9 38

output:

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

result:

ok correct

Test #37:

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

input:

9 9 58

output:

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

result:

ok correct

Test #38:

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

input:

9 9 60

output:

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

result:

ok correct

Test #39:

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

input:

9 10 19

output:

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

result:

ok correct

Test #40:

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

input:

9 10 41

output:

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

result:

ok correct

Test #41:

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

input:

9 10 63

output:

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

result:

ok correct

Test #42:

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

input:

10 9 67

output:

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

result:

ok correct

Test #43:

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

input:

9 11 20

output:

2 3
3 1
1 2
2 4
3 2
1 3
2 1
3 3
1 4
2 2
4 1
5 3
3 4
1 5
2 7
3 5
4 7
5 9
7 10
9 11

result:

ok correct

Test #44:

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

input:

11 9 44

output:

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

result:

ok correct

Test #45:

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

input:

9 11 68

output:

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

result:

ok correct

Test #46:

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

input:

9 11 74

output:

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

result:

ok correct

Test #47:

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

input:

12 9 21

output:

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

result:

ok correct

Test #48:

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

input:

9 12 49

output:

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

result:

ok correct

Test #49:

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

input:

12 9 77

output:

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

result:

ok correct

Test #50:

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

input:

9 12 81

output:

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

result:

ok correct

Test #51:

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

input:

9 13 22

output:

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

result:

ok correct

Test #52:

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

input:

9 13 52

output:

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

result:

ok correct

Test #53:

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

input:

13 9 82

output:

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

result:

ok correct

Test #54:

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

input:

13 9 86

output:

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

result:

ok correct

Test #55:

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

input:

14 9 23

output:

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

result:

ok correct

Test #56:

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

input:

14 9 55

output:

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

result:

ok correct

Test #57:

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

input:

14 9 87

output:

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

result:

ok correct

Test #58:

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

input:

14 9 93

output:

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

result:

ok correct

Test #59:

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

input:

15 9 24

output:

2 3
3 1
1 2
2 4
3 2
1 3
2 1
3 3
1 4
2 2
4 1
5 3
3 4
1 5
2 7
3 5
1 6
3 7
5 6
7 5
9 6
11 7
13 8
15 9

result:

ok correct

Test #60:

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

input:

9 15 58

output:

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

result:

ok correct

Test #61:

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

input:

15 9 92

output:

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

result:

ok correct

Test #62:

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

input:

15 9 100

output:

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

result:

ok correct

Test #63:

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

input:

9 16 25

output:

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

result:

ok correct

Test #64:

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

input:

16 9 61

output:

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

result:

ok correct

Test #65:

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

input:

9 16 97

output:

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

result:

ok correct

Test #66:

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

input:

9 16 107

output:

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

result:

ok correct

Test #67:

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

input:

10 10 20

output:

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

result:

ok correct

Test #68:

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

input:

10 10 46

output:

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

result:

ok correct

Test #69:

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

input:

10 10 72

output:

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

result:

ok correct

Test #70:

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

input:

10 10 74

output:

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

result:

ok correct

Test #71:

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

input:

11 10 21

output:

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

result:

ok correct

Test #72:

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

input:

10 11 49

output:

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

result:

ok correct

Test #73:

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

input:

10 11 77

output:

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

result:

ok correct

Test #74:

score: -100
Time Limit Exceeded

input:

10 11 81

output:


result: