| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 2 | 2 | 2 | 100.000% |
A chess bishop attacks every square that shares a diagonal with it.
Place the maximum number of bishops on an $n \times m$ chessboard in such a way that none of them attack each other.
The first line contains two integers $n$ and $m$: the dimensions of the chessboard (1ドル \leq n, m \leq 10^5 + 1$).
On the first line, print an integer $k$: the maximum possible number of bishops on an $n \times m$ chessboard such that they don't attack each other. On each of the next $k$ lines, print two integers: the coordinates of bishops. The first coordinate should be in the range $[1, n],ドル and the second in the range $[1, m]$. If there are several possible answers, print any one of them.
2 5
6 2 5 1 5 2 3 1 1 1 3 2 1
5 5
8 1 1 1 2 5 4 1 3 5 3 1 4 5 2 1 5