#P1263. [CEOI 2002] Royal guards

[CEOI 2002] Royal guards

Output Format

This problem uses Special Judge.

First output a single integer kk, the maximum number of guards that can be placed.

Then output kk lines. Each line contains two integers x,yx, y, indicating that a guard is placed at row xx and column yy.

3 4
2 0 0 0
2 2 2 1
0 1 0 2

2
1 2
3 3

Hint

Explanation for sample input and output 1:

As shown in the figure (black cells are walls, white cells are empty, circles are traps, and G denotes a guard).

Constraints:

For all testdata, it is guaranteed that 1m,n2001 \leq m, n \leq 200 and 0ai,j20 \leq a_{i, j} \leq 2.

Translated by ChatGPT 5