摘要: 题意:if at some time thei-th position has a boy and the(i + 1)-th position has a girl, then in a second, thei-th position will have a girl and the(i + 1)-th one will have a boy求什么时候不在交换(时间)D. QueueThere arenschoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The b 阅读全文
posted @ 2013-10-11 20:53 baoff 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 题目大意:有多个政策,每个政策里面有很多子网,E 表示加入一个政策,D表示禁止一个政策,F就是询问ip1,ip2是不是在同一个政策中。思路:子网有个特点前缀相同,对于E操作,不难想到用字典树来维护所有子网(即ip的前缀),每个节点用一个vector保存该子网(即前缀)所属于的所有政策的标号。对于D操作,我们用一个数组维护该政策可不可用,对于F就是先把ip1所在的政策做一下标记,然后让ip2所在的政策有没有在这些标记中的即可。//#pragma comment(linker, "/STACK:102400000")#include#include#include#includ 阅读全文
posted @ 2013-10-11 18:23 baoff 阅读(283) 评论(0) 推荐(0) 编辑