POJ 2049 Finding Nemo】的更多相关文章

版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u013497151/article/details/29562915 海底总动员.... 这个题開始不会建图,彻底颠覆曾经我对广搜题的想法.想了好久. 忽然想到省赛时HYPO让我做三维BFS来着,一直没做,看到POJ计划这个题.就是三维BFS解题,就做了一下, 对于这个题.. . . 实在不知道说什么好,又坑.又SB,POJ的后台数据和题目描写叙述的全然不一样,看了DIscuss之后開始 修改代码…
Finding Nemo Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 6952   Accepted: 1584 Description Nemo is a naughty boy. One day he went into the deep sea all by himself. Unfortunately, he became lost and couldn't find his way home. Therefo…
Finding Nemo Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 8631   Accepted: 2019 Description Nemo is a naughty boy. One day he went into the deep sea all by himself. Unfortunately, he became lost and couldn't find his way home. Therefo…
题目:http://poj.org/problem?id=2049 题意: 有一个迷宫,在迷宫中有墙与门 有m道墙,每一道墙表示为(x,y,d,t)x,y表示墙的起始坐标d为0即向右t个单位,都是墙d为1即向上t个单位,都是墙有n道门,每一道门表示为(x,y,d)x,y表示门的起始坐标d为0即向右一个单位表示门d为1即向上一个单位表示门再给出你起点的位置(f1,f2),并保证这个点的位置不会再墙或者门中,为起点到(0,0)最少要穿过多少条门 代码是根据网上大神的稍微改了一下,就交了 #inclu…
Finding Nemo Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 8117   Accepted: 1883 Description Nemo is a naughty boy. One day he went into the deep sea all by himself. Unfortunately, he became lost and couldn't find his way home. Therefo…
poj 2049(二分+spfa判负环) 给你一堆字符串,若字符串x的后两个字符和y的前两个字符相连,那么x可向y连边.问字符串环的平均最小值是多少.1 ≤ n ≤ 100000,有多组数据. 首先根据套路,二分是显然的.然后跑一下spfa判断正环就行了. 然而我被no solution坑了十次提交.. #include <cctype> #include <cstdio> #include <cstring> using namespace std; const in…
http://poj.org/problem?id=2049 题意:有一个迷宫,迷宫中有墙.门和空地.有M道墙,每一道墙用(x,y,d,t)表示,(x,y)表示墙的起始坐标,(d=1,t)表示向上t个单位都是墙:(d=0,t)表示向右t个单位都是墙. 有N扇门,用(x,y,d)表示,(x,y)表示门的起始坐标,d=1,表示向上一个单位都是门:d=0,表示向右一个单位都是门. 给出Nemo的起始位置(f1,f2),问起点到(0,0)的最少要穿过的门. 表示对搜索的题很晕..看到题不知道该怎么存,看…
Finding Palindromes http://poj.org/problem?id=3376 Time Limit: 10000MS   Memory Limit: 262144K       Case Time Limit: 2000MS Description A word is called a palindrome if we read from right to left is as same as we read from left to right. For example…
Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 6988   Accepted: 1600 Description Nemo is a naughty boy. One day he went into the deep sea all by himself. Unfortunately, he became lost and couldn't find his way home. Therefore, he sent a…
题目链接:http://poj.org/problem?id=3376 题意:给你n个字符串m1.m2.m3...mn 求S = mimj(1=<i,j<=n)是回文串的数量 思路:我们考虑第i个字符串和第j个字符串能构成组合回文串要满足的条件: 1.i的长度小于j,那么i一定是j的反串的前缀,且j的反串剩下的后缀是回文串 2.i的长度等于j,那么i等于j的反串 3.i的长度大于j,那么j的反串一定是i的前缀,且i串剩下的后缀是回文串 我们可以将这n个字符串插入trie,每个节点要维护两个值:…