POJ 2706 Connect
题目大意:
题目中给出一种游戏,有黑白两种颜色的棋子,黑色为先手。给定棋盘大小,双方下的棋子的位置和顺序,问黑子下的最后一步棋是否为决定自己胜利的那一步棋(及下了这一步棋后黑棋赢,不下就不赢)。游戏规则如下:
规定黑棋为先手,白棋为后手。
放下棋子A后,若A的8个马步方位,至少存在1个同色的棋子,且当连接A与这些棋子时,其连线不切割已经有的线,则连接。
黑棋的目标是连出一条从X轴的0列到N列的路;
白棋的目标是连出一条从Y轴的0行到N行的路。
就是说某一方要赢棋,当且仅当其把自己的两个“终域”连接在一起,完全阻隔对方的连接。
按照以上规则,判断黑棋所走的最后一步是否为赢棋的一步。
(图为黑子的马步方位,在这些位置有同色棋子且连接线不切割其他已存在的线, 就连接)
解题思路:
1、每下一步棋,记录棋的位置,可连接的其他棋子的位置,并标记这些棋子之间连接。
2、棋子全部下完后在BFS检查是否有一条可以赢的连接线,如果没有输出no。
3、如果有,再次BFS,当遇到最后一个点时不将他放入队列,看是否还能BFS一条路。
4、如果能输出no,不能输出yes。
注意:
1、判断是否可以连接时,要考虑全所有情况。
2、BFS时最后一步棋可能是连接线的第一个棋子,要注意所有棋子都要判断。
(感谢大牛博客的指点)
下面是代码:
#include <stdio.h>
#include <string.h>
const int M=23,Mx=255;
int map1[M][M];
struct node
{int x,y;
} po[Mx];
bool vis[Mx][Mx];
int n,m;
int posx[]= {0,-1,-2,-2,-1,1,2,2,1}; //对应于(x,y)的八个方位
int posy[]= {0,2,1,-1,-2,-2,-1,1,2};
void Link(int re,int ce,int i)
{for(int k=1; k<=8; k++){int r=re+posx[k];int c=ce+posy[k];if(r>=0 && r<=n && c>=0 && c<=n) //检查边界{if(map1[r][c]!=-1 && map1[r][c]%2==i%2) //检查颜色{switch(k) //"日"字对角连线{case 1: //30度方位{if(map1[r][c-2]!=-1&&map1[r+1][c]!=-1&&vis[ map1[r][c-2] ][ map1[r+1][c] ])break;if(c-3>=0 && map1[r][c-3]!=-1&&map1[r+1][c-1]!=-1&&vis[ map1[r][c-3] ][ map1[r+1][c-1] ])break;if(c+1<=n &&map1[r][c-1]!=-1&&map1[r+1][c+1]!=-1&& vis[ map1[r][c-1] ][ map1[r+1][c+1] ])break;if(r-1>=0){if(map1[r-1][c-2]!=-1&&map1[r+1][c-1]!=-1&&vis[ map1[r-1][c-2] ][ map1[r+1][c-1] ])break;if(map1[r-1][c-1]!=-1&&map1[r+1][c]!=-1&&vis[ map1[r-1][c-1] ][ map1[r+1][c] ])break;if(map1[r-1][c]!=-1&&map1[r+1][c-1]!=-1&&vis[ map1[r-1][c] ][ map1[r+1][c-1] ])break;}if(r+2<=n){if(map1[r+2][c-2]!=-1&&map1[r][c-1]!=-1&&vis[ map1[r+2][c-2] ][ map1[r][c-1] ])break;if(map1[r+2][c-1]!=-1&&map1[r][c-2]!=-1&&vis[ map1[r+2][c-1] ][ map1[r][c-2] ])break;if(map1[r+2][c]!=-1&&map1[r][c-1]!=-1&&vis[ map1[r+2][c] ][ map1[r][c-1] ])break;}int a=map1[re][ce];int b=map1[r][c];vis[a][b]=vis[b][a]=true;break;}case 2: //60度方位{if(map1[r][c-1]!=-1&&map1[r+2][c]!=-1&&vis[ map1[r][c-1] ][ map1[r+2][c] ])break;if(r-1>=0 &&map1[r-1][c-1]!=-1&&map1[r+1][c]!=-1&& vis[ map1[r-1][c-1] ][ map1[r+1][c] ])break;if(r+3<=n &&map1[r+1][c-1]!=-1&&map1[r+3][c]!=-1&& vis[ map1[r+1][c-1] ][ map1[r+3][c] ])break;if(c-2>=0){if(map1[r][c-2]!=-1&&map1[r+1][c]!=-1&&vis[ map1[r][c-2] ][ map1[r+1][c] ])break;if(map1[r+1][c-2]!=-1&&map1[r+2][c]!=-1&&vis[ map1[r+1][c-2] ][ map1[r+2][c] ])break;if(map1[r+2][c-2]!=-1&&map1[r+1][c]!=-1&&vis[ map1[r+2][c-2] ][ map1[r+1][c] ])break;}if(c+1<=n){if(map1[r][c-1]!=-1&&map1[r+1][c+1]!=-1&&vis[ map1[r][c-1] ][ map1[r+1][c+1] ])break;if(map1[r+1][c-1]!=-1&&map1[r][c+1]!=-1&&vis[ map1[r+1][c-1] ][ map1[r][c+1] ])break;if(map1[r+1][c-1]!=-1&&map1[r+2][c+1]!=-1&&vis[ map1[r+1][c-1] ][ map1[r+2][c+1] ])break;}int a=map1[re][ce];int b=map1[r][c];vis[a][b]=vis[b][a]=true;break;}case 3: //120度方位{if(map1[r][c+1]!=-1&&map1[r+2][c]!=-1&&vis[ map1[r][c+1] ][ map1[r+2][c] ])break;if(r-1>=0 && map1[r-1][c+1]!=-1&&map1[r+1][c]!=-1&&vis[ map1[r-1][c+1] ][ map1[r+1][c] ])break;if(r+3<=n && map1[r+1][c+1]!=-1&&map1[r+3][c]!=-1&&vis[ map1[r+1][c+1] ][ map1[r+3][c] ])break;if(c-1>=0){if(map1[r][c-1]!=-1&&map1[r+1][c+1]!=-1&&vis[ map1[r][c-1] ][ map1[r+1][c+1] ])break;if(map1[r+1][c-1]!=-1&&map1[r][c+1]!=-1&&vis[ map1[r+1][c-1] ][ map1[r][c+1] ])break;if(map1[r+2][c-1]!=-1&&map1[r+1][c+1]!=-1&&vis[ map1[r+2][c-1] ][ map1[r+1][c+1] ])break;}if(c+2<=n){if(map1[r+1][c]!=-1&&map1[r][c+2]!=-1&&vis[ map1[r+1][c] ][ map1[r][c+2] ])break;if(map1[r+2][c]!=-1&&map1[r+1][c+2]!=-1&&vis[ map1[r+2][c] ][ map1[r+1][c+2] ])break;if(map1[r+1][c]!=-1&&map1[r+2][c+2]!=-1&&vis[ map1[r+1][c] ][ map1[r+2][c+2] ])break;}int a=map1[re][ce];int b=map1[r][c];vis[a][b]=vis[b][a]=true;break;}case 4: //150度方位{if(map1[r][c+2]!=-1&&map1[r+1][c]!=-1&&vis[ map1[r][c+2] ][ map1[r+1][c] ])break;if(c-1>=0 &&map1[r+1][c-1]!=-1&&map1[r][c+1]!=-1&& vis[ map1[r+1][c-1] ][ map1[r][c+1] ])break;if(c+3<=n &&map1[r+1][c+1]!=-1&&map1[r][c+3]!=-1&& vis[ map1[r+1][c+1] ][ map1[r][c+3] ])break;if(r-1>=0){if(map1[r-1][c]!=-1&&map1[r+1][c+1]!=-1&&vis[ map1[r-1][c] ][ map1[r+1][c+1] ])break;if(map1[r-1][c+1]!=-1&&map1[r+1][c]!=-1&&vis[ map1[r-1][c+1] ][ map1[r+1][c] ])break;if(map1[r-1][c+2]!=-1&&map1[r+1][c+1]!=-1&&vis[ map1[r-1][c+2] ][ map1[r+1][c+1] ])break;}if(r+2<=n){if(map1[r][c+1]!=-1&&map1[r+2][c]!=-1&&vis[ map1[r][c+1] ][ map1[r+2][c] ])break;if(map1[r][c+1]!=-1&&map1[r+2][c+2]!=-1&&vis[ map1[r][c+1] ][ map1[r+2][c+2] ])break;if(map1[r][c+2]!=-1&&map1[r+2][c+1]!=-1&&vis[ map1[r][c+2] ][ map1[r+2][c+1] ])break;}int a=map1[re][ce];int b=map1[r][c];vis[a][b]=vis[b][a]=true;break;}case 5: //210度方位{if(map1[r-1][c]!=-1&&map1[r][c+2]!=-1&&vis[ map1[r-1][c] ][ map1[r][c+2] ])break;if(c-1>=0 &&map1[r-1][c-1]!=-1&&map1[r][c+1]!=-1&& vis[ map1[r-1][c-1] ][ map1[r][c+1] ])break;if(c+3<=n &&map1[r-1][c+1]!=-1&&map1[r][c+3]!=-1&& vis[ map1[r-1][c+1] ][ map1[r][c+3] ])break;if(r-2>=0){if(map1[r-2][c]!=-1&&map1[r][c+1]!=-1&&vis[ map1[r-2][c] ][ map1[r][c+1] ])break;if(map1[r-2][c+1]!=-1&&map1[r][c+2]!=-1&&vis[ map1[r-2][c+1] ][ map1[r][c+2] ])break;if(map1[r-2][c+2]!=-1&&map1[r][c+1]!=-1&&vis[ map1[r-2][c+2] ][ map1[r][c+1] ])break;}if(r+1<=n){if(map1[r][c]!=-1&&map1[r-1][c+1]!=-1&&vis[ map1[r][c] ][ map1[r-1][c+1] ])break;if(map1[r+1][c+1]!=-1&&map1[r-1][c]!=-1&&vis[ map1[r+1][c+1] ][ map1[r-1][c] ])break;if(map1[r+1][c+2]!=-1&&map1[r-1][c+1]!=-1&&vis[ map1[r+1][c+2] ][ map1[r-1][c+1] ])break;}int a=map1[re][ce];int b=map1[r][c];vis[a][b]=vis[b][a]=true;break;}case 6: //240度方位{if(map1[r-2][c]!=-1&&map1[r][c+1]!=-1&&vis[ map1[r-2][c] ][ map1[r][c+1] ])break;if(r-3>=0 && map1[r-3][c]!=-1&&map1[r-1][c+1]!=-1&&vis[ map1[r-3][c] ][ map1[r-1][c+1] ])break;if(r+1<=n &&map1[r-1][c]!=-1&&map1[r+1][c+1]!=-1&& vis[ map1[r-1][c] ][ map1[r+1][c+1] ])break;if(c-1>=0){if(map1[r-2][c-1]!=-1&&map1[r-1][c+1]!=-1&&vis[ map1[r-2][c-1] ][ map1[r-1][c+1] ])break;if(map1[r-1][c-1]!=-1&&map1[r][c+1]!=-1&&vis[ map1[r-1][c-1] ][ map1[r][c+1] ])break;if(map1[r][c-1]!=-1&&map1[r-1][c+1]!=-1&&vis[ map1[r][c-1] ][ map1[r-1][c+1] ])break;}if(c+2<=n){if(map1[r-1][c]!=-1&&map1[r-2][c+2]!=-1&&vis[ map1[r-1][c] ][ map1[r-2][c+2] ])break;if(map1[r-2][c]!=-1&&map1[r-1][c+2]!=-1&&vis[ map1[r-2][c] ][ map1[r-1][c+2] ])break;if(map1[r-1][c]!=-1&&map1[r][c+2]!=-1&&vis[ map1[r-1][c] ][ map1[r][c+2] ])break;}int a=map1[re][ce];int b=map1[r][c];vis[a][b]=vis[b][a]=true;break;}case 7: //300度方位{if(map1[r-2][c]!=-1&&map1[r][c-1]!=-1&&vis[ map1[r-2][c] ][ map1[r][c-1] ])break;if(r-3>=0 && map1[r-3][c]!=-1&&map1[r-1][c-1]!=-1&&vis[ map1[r-3][c] ][ map1[r-1][c-1] ])break;if(r+1<=n &&map1[r-1][c]!=-1&&map1[r+1][c-1]!=-1&& vis[ map1[r-1][c] ][ map1[r+1][c-1] ])break;if(c-2>=0){if(map1[r-2][c-2]!=-1&&map1[r-1][c]!=-1&&vis[ map1[r-2][c-2] ][ map1[r-1][c] ])break;if(map1[r-1][c-2]!=-1&&map1[r-2][c]!=-1&&vis[ map1[r-1][c-2] ][ map1[r-2][c] ])break;if(map1[r][c-2]!=-1&&map1[r-1][c]!=-1&&vis[ map1[r][c-2] ][ map1[r-1][c] ])break;}if(c+1<=n){if(map1[r-1][c-1]!=-1&&map1[r-2][c+1]!=-1&&vis[ map1[r-1][c-1] ][ map1[r-2][c+1] ])break;if(map1[r][c-1]!=-1&&map1[r-1][c+1]!=-1&&vis[ map1[r][c-1] ][ map1[r-1][c+1] ])break;if(map1[r-1][c-1]!=-1&&map1[r][c+1]!=-1&&vis[ map1[r-1][c-1] ][ map1[r][c+1] ])break;}int a=map1[re][ce];int b=map1[r][c];vis[a][b]=vis[b][a]=true;break;}case 8: //330度方位{if(map1[r][c-2]!=-1&&map1[r-1][c]!=-1&&vis[ map1[r][c-2] ][ map1[r-1][c] ])break;if(c-3>=0 &&map1[r][c-3]!=-1&&map1[r-1][c-1]!=-1&& vis[ map1[r][c-3] ][ map1[r-1][c-1] ])break;if(c+1<=n &&map1[r][c-1]!=-1&&map1[r-1][c+1]!=-1&& vis[ map1[r][c-1] ][ map1[r-1][c+1] ])break;if(r-2>=0){if(map1[r-2][c-2]!=-1&&map1[r][c-1]!=-1&&vis[ map1[r-2][c-2] ][ map1[r][c-1] ])break;if(map1[r-2][c-1]!=-1&&map1[r][c-2]!=-1&&vis[ map1[r-2][c-1] ][ map1[r][c-2] ])break;if(map1[r-2][c]!=-1&&map1[r][c-1]!=-1&&vis[ map1[r-2][c] ][ map1[r][c-1] ])break;}if(r+1<=n){if(map1[r-1][c-1]!=-1&&map1[r+1][c-2]!=-1&&vis[ map1[r-1][c-1] ][ map1[r+1][c-2] ])break;if(map1[r-1][c-1]!=-1&&map1[r+1][c]!=-1&&vis[ map1[r-1][c-1] ][ map1[r+1][c] ])break;if(map1[r-1][c]!=-1&&map1[r+1][c-1]!=-1&&vis[ map1[r-1][c] ][ map1[r+1][c-1] ])break;}int a=map1[re][ce];int b=map1[r][c];vis[a][b]=vis[b][a]=true;break;}}}}}return;
}
bool Check(bool flag)
{int NUM;if(!flag) //通过舍弃最后一步棋,检查最后一步棋是否为决定赢棋的一步NUM=m;for(int k=0; k<=n; k++){int p=map1[0][k];if(p!=-1 && p!=NUM-1 && p%2==0){int queue[Mx];bool vist[Mx]= {false};int head=0;int tail=0;queue[tail]=p;tail++;vist[p]=true;while(head<tail){int s=queue[head];head++;if(po[s].x==n){return true;}for(int i=0; i<=m; i++){int x=-1;if(vis[s][i]){x=i;}if(x!=-1&&!vist[x]){vist[x]=true;if(!flag && x==NUM-1)continue;queue[tail++]=x;}}}}}return false;
}
int main()
{int i,x,y;while(scanf("%d%d",&n,&m),n||m){memset(map1,-1,sizeof(map1));memset(vis,false,sizeof(vis));for(i=0; i<m; i++){scanf("%d%d",&po[i].x,&po[i].y);map1[po[i].x][po[i].y]=i;Link(po[i].x,po[i].y,i);}if(Check(true) && !Check(false)){printf("yes\n");}else{printf("no\n");}}return 0;
}
测试数据:
Sample Input
4 5
0 2 2 4 4 2 3 2 2 3
4 5
0 2 2 4 4 2 3 2 2 1
7 11
0 3 6 5 3 2 5 7 7 2 4 4 5 3 5 2 4 5 4 0 2 4
5 9
3 1 3 3 0 2 2 5 2 3 2 1 4 3 4 0 5 1
4 5
0 1 2 0 1 3 2 2 4 1
8 17
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8 4 3
8 21
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8 0 1 5 8 8 5 3 7 4 3
8 21
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8 0 1 5 8 8 5 4 4 4 3
8 21
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8 0 1 5 8 8 3 4 4 4 3
8 21
2 2 2 3 2 4 2 0 3 1 1 6 3 5 4 1 5 1 4 5 5 5 6 0 6 2 6 3 6 4 1 8 0 1 5 8 8 5 3 3 4 3
10 99
5 4 7 9 7 3 8 7 1 8 8 10 5 5 5 3 10 7 7 10 4 1 2 2 9 5 3 5 3 9 9 8 4 8 4 2 2 1 2 4 10 4 4 0 0 7 7 0 1 1 9 7 1 7 9 10 0 1 3 7 10 1 7 1 2 3 7 7 7 2 4 5 5 1 6 0 7 4 9 3 3 6 1 4 9 1 2 5 0 9 5 10 4 4 1 3 2 6 1 2 9 9 5 8 4 3 3 10 8 6 1 10 4 7 7 8 6 7 2 10 6 6 5 9 10 6 3 0 5 2 3 3 0 5 8 2 10 5 5 0 4 6 8 8 1 9 2 0 2 9 8 5 0 3 2 8 7 6 1 6 8 1 5 7 7 5 3 4 8 3 6 4 9 6 2 7 0 6 1 0 10 8 6 8 5 6 4 10 10 2 6 1 10 3 4 9 3 1
20 221
0 4 8 15 15 3 3 2 1 15 8 11 1 18 6 1 6 4 12 1 16 13 19 1 9 18 5 17 15 12 6 7 19 5 14 15 12 9 6 19 16 6 13 9 3 15 15 13 19 11 9 11 20 14 2 11 12 15 18 4 19 4 12 16 17 10 17 20 2 9 6 20 0 16 19 9 8 18 11 13 14 13 13 17 4 19 14 1 14 12 10 15 6 10 12 10 2 6 17 16 19 18 12 17 13 2 14 2 18 9 17 3 20 5 14 16 7 6 5 5 15 2 6 12 8 6 16 18 1 17 9 16 14 5 8 2 7 1 15 7 15 8 2 1 4 3 1 2 15 4 10 14 10 7 12 19 1 7 3 14 6 15 15 14 11 19 12 4 17 18 6 5 10 2 17 0 9 13 1 5 0 1 13 7 5 16 8 5 9 8 16 3 3 16 18 13 11 6 3 9 8 7 10 19 8 13 15 10 7 4 12 7 8 17 4 14 7 17 11 16 0 13 16 11 6 6 16 2 2 17 8 3 16 15 1 10 2 15 4 2 9 4 12 2 19 8 15 5 14 14 16 9 16 5 9 10 3 7 2 13 7 13 6 9 3 13 10 1 15 18 14 3 2 19 5 0 4 11 7 14 12 3 13 20 17 7 16 17 12 6 18 18 18 14 5 20 12 8 16 0 15 9 5 4 2 3 8 10 20 10 14 7 14 17 8 16 4 5 19 2 10 18 11 18 6 17 11 10 3 8 10 13 13 11 1 6 10 5 7 15 5 12 14 6 7 9 10 3 8 19 8 1 11 4 7 0 13 19 7 12 19 16 17 14 3 12 5 13 12 11 3 0 18 12 3 5 3 19 6 2 0 3 17 17 7 10 13 3 4 15 17 19 20 7 8 8 7 2 10 11 18 17 11 9 15 1 19 0 16 4 13 16 5 8 11 3 20 18 16 19 19 13 18 16 14 19 5 19 15 16 17 2 2 5 9 7 16 7 14 9 0 5
20 221
0 4 8 15 15 3 3 2 1 15 8 11 1 18 6 1 6 4 12 1 16 13 19 1 9 18 5 17 15 12 6 7 19 5 14 15 12 9 6 19 16 6 13 9 3 15 15 13 19 11 9 11 20 14 2 11 12 15 18 4 19 4 12 16 17 10 17 20 2 9 6 20 0 16 19 9 8 18 11 13 14 13 13 17 4 19 14 1 14 12 10 15 6 10 12 10 2 6 17 16 19 18 12 17 13 2 14 2 18 9 17 3 20 5 14 16 7 6 5 5 15 2 6 12 8 6 16 18 1 17 9 16 14 5 8 2 7 1 15 7 15 8 2 1 4 3 1 2 15 4 10 14 10 7 12 19 1 7 3 14 6 15 15 14 11 19 12 4 17 18 6 5 10 2 17 0 9 13 1 5 0 1 13 7 5 16 8 5 9 8 16 3 3 16 18 13 11 6 3 9 8 7 10 19 8 13 15 10 7 4 12 7 8 17 4 14 7 17 11 16 0 13 16 11 6 6 16 2 2 17 8 3 16 15 1 10 2 15 4 2 9 4 12 2 19 8 15 5 14 14 16 9 16 5 9 10 3 7 2 13 7 13 6 9 3 13 10 1 15 18 14 3 2 19 5 0 4 11 7 14 12 3 13 20 17 7 16 17 12 6 18 18 18 14 5 20 12 8 16 0 15 9 5 4 2 3 8 10 20 10 14 7 14 17 8 16 4 5 19 2 10 18 11 18 6 17 11 10 3 8 10 13 13 11 1 6 10 5 7 15 5 12 14 6 7 9 10 3 8 19 8 1 11 4 7 0 13 19 7 12 19 16 17 14 3 12 5 13 12 11 3 0 18 12 3 5 3 19 6 2 0 3 17 17 7 10 13 3 4 15 17 19 20 7 8 8 7 2 10 11 18 17 11 9 15 1 19 0 16 4 13 16 5 8 11 3 20 18 16 19 19 13 18 16 14 19 5 19 15 16 17 2 2 5 9 7 16 7 14 9 1 14
10 97
5 4 7 9 7 3 8 7 1 8 8 10 5 5 5 3 10 7 7 10 4 1 2 2 9 5 3 5 3 9 9 8 4 8 4 2 2 1 2 4 10 4 4 0 0 7 7 0 1 1 9 7 1 7 9 10 0 1 3 7 10 1 7 1 2 3 7 7 7 2 4 5 5 1 6 0 7 4 9 3 3 6 1 4 9 1 2 5 0 9 5 10 4 4 1 3 2 6 1 2 9 9 5 8 4 3 3 10 8 6 1 10 4 7 7 8 6 7 2 10 6 6 5 9 10 6 3 0 5 2 3 3 0 5 8 2 10 5 5 0 4 6 8 8 1 9 2 0 2 9 8 5 0 3 2 8 7 6 1 6 8 1 5 7 7 5 3 4 8 3 6 4 9 6 2 7 0 6 1 0 10 8 6 8 5 6 4 10 10 2 6 1 10 3
5 4 7 9 7 3 8 7 1 8 8 10 5 5 5 3 10 7 7 10 4 1 2 2 9 5 3 5 3 9 9 8 4 8 4 2 2 1 2 4 10 4 4 0 0 7 7 0 1 1 9 7 1 7 9 10 0 1 3 7 10 1 7 1 2 3 7 7 7 2 4 5 5 1 6 0 7 4 9 3 3 6 1 4 9 1 2 5 0 9 5 10 4 4 1 3 2 6 1 2 9 9 5 8 4 3 3 10 8 6 1 10 4 7 7 8 6 7 2 10 6 6 5 9 10 6 3 0 5 2 3 3 0 5 8 2 10 5 5 0 4 6 8 8 1 9 2 0 2 9 8 5 0 3 2 8 7 6 1 6 8 1 5 7 7 5 3 4 8 3 6 4 9 6 2 7 0 6 1 0 10 8 6 8 5 6 4 10 10 2 6 1 10 3 4 9 1 5
0 0
no
yes
yes
yes
no
no
yes
no
yes
no
yes
yes
no
no
no
POJ 2706 Connect相关推荐
- poj——3177Redundant Paths
poj--3177Redundant Paths 洛谷-- P2860 [USACO06JAN]冗余路径Redundant Paths Time Limit: 1000MS Memory ...
- 【POJ】【2449】Remmarguts' Date
K短路/A* 经(luo)典(ti) K短路题目= = K短路学习:http://www.cnblogs.com/Hilda/p/3226692.html 流程: 先把所有边逆向,做一遍dijkstr ...
- (最小生成树) Networking -- POJ -- 1287
链接: http://poj.org/problem?id=1287 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7494 ...
- 【转载】图论 500题——主要为hdu/poj/zoj
转自--http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并 ...
- POJ 3436 ACM Computer Factory(最大流+路径输出)
http://poj.org/problem?id=3436 题意: 每台计算机包含P个部件,当所有这些部件都准备齐全后,计算机就组装完成了.计算机的生产过程通过N台不同的机器来完成,每台机器用它的性 ...
- POJ 3133 Manhattan Wiring (插头DP)
Manhattan Wiring Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 1110 Accepted: 634 D ...
- (poj)1064 Cable master 二分+精度
题目链接:http://poj.org/problem?id=1064 DescriptionInhabitants of the Wonderland have decided to hold a ...
- 【POJ - 3177】Redundant Paths(边双连通分量,去重边)
题干: In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1.. ...
- POJ - 1251(最小生成树.krustal)
题目链接:http://poj.org/problem?id=1251 题目: Jungle Roads Time Limit: 1000MS Memory Limit: 10000K Total ...
- poj 1383 Labyrinth
题目连接 http://poj.org/problem?id=1383 Labyrinth Description The northern part of the Pyramid contains ...
最新文章
- oracle恢复误删除记录
- Java EE官方文档汇总
- [转]UI设计小技巧
- Dominant Character 思维,字符串,贪心
- JavaOne 2016后续活动
- 鸿蒙系统6月可升级,华为鸿蒙2.0系统大规模升级从6月开始?
- c语言中建一个文件的语法,C语言语法介绍_文件.ppt
- Android开发笔记(一百五十四)OpenGL的画笔工具GL10
- 创建docker容器的命令
- postman面试_接口测试面试常见问题
- 用 Python 做股市数据分析(2)
- 微信群管理助手哪里弄的?
- 兄弟1218无线打印服务器错误,兄弟无线打印机无法打印怎么办?
- 如何删除word空白页技巧汇总
- negroni-gzip源码分析
- 你们寻找的微信小程序考题,这总结了
- 新时间和日期 API-时间校正器(Java8新特性)
- 关于mysql中5位数字转化为日期格式的问题
- STM32(1)跑马灯
- 电子科技大学信息与软件工程学院考研初试时间规划和用书推荐
热门文章
- 网络安全——WEP实现无线局域网安全
- 计算机内部数据的传输 进制,计算机内部数据加工处理和传送的形式是什么
- storm的核心组件,编程模型,一般机构图
- 大数据可视化--全球分布散点图
- 3个月测试员自述:4个影响我职业生涯的重要技能
- 压缩包文件的解压码如何破解
- spark本地项目报错:Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
- 《算法竞赛进阶指南》 防线
- 计算机安全的最后一道防线,网络安全的第一道防线是(图文)
- cf 1443C The Delivery Dilemma