No Cheating(Google Code Jam 2008 Round 3C)二分图最大独立集

本地一所高中的期末考试将在一个大教室中举行,但有些学生总是试图在考试中偷看别人的答案!教室被视为一个M行N列的矩形网格,每个单元格代表一个座位。为了防止作弊,必须确保每个人不能看到其他人的答案。题目要求确定最多可以安排多少名学生坐下,使得没有人能看到其他人的答案。输入包含教室的尺寸和座位状态,输出能容纳的最大学生数。案例限制和数据规模也给出。

来自《挑战程序设计竞赛》

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 classro

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值