Description The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable milk-cows. He wonders how many guards he will need if he wishes to put one on top of each hill. He has a map supplied as a matr…
1619: [Usaco2008 Nov]Guarding the Farm 保卫牧场 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 498  Solved: 223[Submit][Status] Description The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable milk…
题目 1619: [Usaco2008 Nov]Guarding the Farm 保卫牧场 Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 491  Solved: 218 [Submit][Status] Description The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable…
http://www.lydsy.com/JudgeOnline/problem.php?id=1619 首先不得不说,,题目没看懂.... 原来就是找一个下降的联通块.... 排序后dfs标记即可.. #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream> #include <algorithm> #inc…
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1619 题意: 给你一个n*m的地形图,位置(x,y)的海拔为h[x][y]. 一个山顶的定义为:可以是一个点,或是一片海拔相同的区域. 要求为山顶周围(每个点的八个方向)的海拔均比山顶低(或为边界). 问你有多少个山顶. 题解: dfs灌水法. 将所有点按海拔从高到低排序. 依次从每个点灌水,水流到的地方做标记. 灌水:如果一个点有水,则它周围海拔比它低的点也会被水淹. AC Code:…
Description The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable milk-cows. He wonders how many guards he will need if he wishes to put one on top of each hill. He has a map supplied as a matr…
不是严格小于是小于等于啊!!!!!不是严格小于是小于等于啊!!!!!不是严格小于是小于等于啊!!!!! 是我看不懂人话还是翻译不说人话= = 把所有格子按值排个序,bfs扩展打标记即可 #include<iostream> #include<cstdio> #include<algorithm> #include<queue> using namespace std; const int N=705,dx[]={-1,-1,-1,0,0,1,1,1},dy[…
描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1619 给出一张图每个点的高度,在一个点上安排守卫可以监视周围所有不高于于当前点的点.也就是类似在一个点上灌水,周围(8格)低于它的点都会有水,然后继续...求最少的守卫数. 分析 首先图中的最高点必须是要灌水的,所以就从当前最高的开始宽搜,有水的点标记掉就好了. #include <bits/stdc++.h> #define fst first #define scd second us…
P2919 [USACO08NOV]守护农场Guarding the Farm 题目描述 The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable milk-cows. He wonders how many guards he will need if he wishes to put one on top of each hill…
1231: [Usaco2008 Nov]mixup2 混乱的奶牛 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 685  Solved: 383[Submit][Status][Discuss] Description 混乱的奶牛 [Don Piele, 2007] Farmer John的N(4 <= N <= 16)头奶牛中的每一头都有一个唯一的编号S_i (1 <= S_i <= 25,000). 奶牛为她们的编号感到骄傲,…