4539: P3956 [NOIP2017 普及组] 棋盘
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:3
Solved:0
Description

Input

Output

Sample Input Copy
输入 #1
5 7
1 1 0
1 2 0
2 2 1
3 3 1
3 4 0
4 4 1
5 5 0
输入 #2
5 5
1 1 0
1 2 0
2 2 1
3 3 1
5 5 0
Sample Output Copy
HINT