来自《挑战程序设计竞赛》
1.题目原文
Problem
A local high school is going to hold a final exam in a big classroom. However, some students in this school are always trying to see each other's answer sheet during exams!
The classroom can be regarded as a rectangle of M rows by N columns of unit squares, where each unit square represents a seat.
The school principal decided to set the following rule to prevent cheating:
Assume a student is able to see his left, right, upper-left, and upper-right neighbors' answer sheets. The assignment of seats must guarantee that nobody's answer sheet can be seen by any other student.
As in this picture, it will not be a good idea to seat anyone in A, C, D, or E because the boy in the back row would be able to see their answer sheets. However, if there is a girl sitting in B, he will not be able to see her answer sheet.
Some seats in the classroom are broken, and we cannot put a stud