POJ3057:Evacuation——题解】的更多相关文章

POJ3057 Evacuation 二分图匹配+最短路 题目描述 Fires can be disastrous, especially when a fire breaks out in a room that is completely filled with people. Rooms usually have a couple of exits and emergency exits, but with everyone rushing out at the same time, it…
http://poj.org/problem?id=3057 题目大意: .为人,D为门,X为障碍,门每秒只能出去一个人,问多少秒出光. 如果无法出光输出impossible. ———————————————— 首先bfs处理出来每个人到每个门的最短距离. 然后枚举时间,将时间与门作为二元组(或者理解为是make_pair也行) 当(当前时间)>=(该人到该门的时间),就把(这个人)与(这个门和当前时间的二元组)连起来. 然后二分图匹配找到匹配数比较和人数相不相等即可. #include<cs…
题目 Fires can be disastrous, especially when a fire breaks out in a room that is completely filled with people. Rooms usually have a couple of exits and emergency exits, but with everyone rushing out at the same time, it may take a while for everyone…
The Japanese government plans to increase the number of inbound tourists to forty million in the year 2020, and sixty million in 2030. Not only increasing touristic appeal but also developing tourism infrastructure further is indispensable to accompl…
人作X部:把门按时间拆点,作Y部:如果某人能在某个时间到达某门则连边.就是个二分图最大匹配. 时间可以二分枚举,或者直接从1枚举时间然后加新边在原来的基础上进行增广. 谨记:时间是个不可忽视的维度. #include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; #define INF (1<<30) #define MAXN…
题目: 题意: 有人,门(只有边上有,且1s只能出去一个人),和墙,每s人可移动一个格子,问多少秒所有人可以逃出,逃不出输出“impossible” 分析: 首先,我们先想着样一个问题,如果这个人在某一秒可以到达了这个们,他将可以在这1s之后的任一没人通过此门的时刻出门.而且题意说每个门每一刻只能使1人通过,那么我们可以直接把门分成好多门(1s一个,当然时间有上线),然后让人和这些门去匹配就好了,看一下第几秒可以人都匹配上就好了,当然我们加一个二分不要一个一个跑了,最后复杂度:10(二分)*10…
题目: 题意: 在某一秒,每个人可以进行一个移动:去旁边座位,去过道,在过道向出口走,求最少多少秒可以让所有人离开(具体如图和样例). 分析: 首先,我们先考虑简单的,只考虑出口前有什么事件发生:1.这一秒有人出出口,2.这一秒没人出出口. 而如果有人出出口,一定是一个人(注意重音,在第二个一上),所有有人出出口的秒数就是人数,而没人出出口的秒数便是我们要求的秒数. 怎样才会没人出出口呢?如果过道里一人挤着一人,那必定是每秒都有人出出口,而一但中间有空缺,这一秒就不会有人出出口,所有我们只需算出…
"Evacuation Plan" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100002 Description The City has a number of municipal buildings and a number of fallout shelters that were build specially to hide municipal workers in case …
Evacuation 题目连接: http://poj.org/problem?id=3057 Description Fires can be disastrous, especially when a fire breaks out in a room that is completely filled with people. Rooms usually have a couple of exits and emergency exits, but with everyone rushin…
Evacuation Plan Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5665Accepted: 1481Special Judge 题目链接:http://poj.org/problem?id=2175 Description: The City has a number of municipal buildings and a number of fallout shelters that were build sp…