POJ 3620 Avoid The Lakes】的更多相关文章

Avoid The Lakes Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8173   Accepted: 4270 Description Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of wate…
Avoid The Lakes Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6795   Accepted: 3622 Description Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of wate…
Avoid The Lakes Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6826   Accepted: 3637 Description Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of wate…
http://poj.org/problem?id=3620 DFS 从任意一个lake出发 重置联通的lake 并且记录 更新ans #include <iostream> #include <string.h> #include <stdio.h> using namespace std; int N,M,K; ][]; ][] = {-, , , , , , , -}; ; ; bool OK(int x, int y) { || x > N || y &l…
题目 找最大的一片湖的面积,4便有1边相连算相连,4角不算. runtime error 有一种可能是 数组开的太小,越界了 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> #include<queue> using namespace std; #define MAXN 110 in…
题意:给出一个农田的图,n行m列,再给出k个被淹没的坐标( i , j ).求出其中相连的被淹没的农田的最大范围. 思路:dfs算法 代码: #include<iostream> #include<stdio.h> using namespace std; int t[150][150]; int visit[150][150]; int n,m,k; int dfs(int i,int j){ if(i<1||j<1||i>n||j>m||t[i][j]=…
Description Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of water. His insurance agency will only repay him, however, an amount depending on the size of the larges…
Avoid The Lakes Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submission(s) : 190   Accepted Submission(s) : 106 Problem Description Farmer John's farm was flooded in the most recent storm, a fact only aggrav…
题意:给出一个矩阵,其中有些格子干燥.有些潮湿. 如果一个潮湿的格子的相邻的四个方向有格子也是潮湿的,那么它们就可以构成更大 的湖泊,求最大的湖泊. 也就是求出最大的连在一块儿的潮湿的格子的数目. #include<iostream> #include<cstring> using namespace std; ][]={}; ][]={-,,,,,-,,}; ,ans=,n,m,k; void dfs(int a,int b) { int a1,b1; ans++; aa[a][…
题意: 给你n*m的矩形,有k个坏点 问最大坏点连通块的坏点数. 一发水题.. 裸的DFS // by SiriusRen #include <cstdio> #include <algorithm> using namespace std; int n,m,k,jy,jyx,jyy,xx[]={1,-1,0,0},yy[]={0,0,1,-1},a[105][105],vis[105][105],ans=0; void dfs(int x,int y){ for(int i=0;…