A /*Huyyt*/ #include<bits/stdc++.h> #define mem(a,b) memset(a,b,sizeof(a)) #define pb push_back using namespace std; typedef long long ll; typedef unsigned long long ull; ][] = {{, }, {, }, {, -}, { -, }, {, }, {, -}, { -, -}, { -, }}; ; + + + + 1e9…
这道题目甚长, 代码也是甚长, 但是思路却不是太难.然而有好多代码实现的细节, 确是十分的巧妙. 对代码阅读能力, 代码理解能力, 代码实现能力, 代码实现技巧, DFS方法都大有裨益, 敬请有兴趣者耐心细读.(也许由于博主太弱, 才有此等感觉). 题目: UVa 1103 In order to understand early civilizations, archaeologists often study texts written in  ancient languages. One…
C. Edgy Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a tree (a connected undirected graph without cycles) of nn vertices. Each of the n−1n−1 edges of the tree is col…
时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld 题目描述 璐神现在有张n*m大小的地图,地图上标明了陆地(用"#"表示)和海洋(用"."表示),现在璐神要计算这张地图上岛屿的数量. 已知岛屿是由陆地的连通块组成,即一块陆地的上.下.左.右,左上,右上,左下,右下有其他陆地,则构成连通块,以此类推. 此外,岛屿的详细定义如下: 1.岛屿的周围必须全是海洋. 2.如果连通块有任意…
题目链接:http://codeforces.com/problemset/problem/377/A 题解: 有tot个空格(输入时统计),把其中k个空格变为wall,问怎么变才能使得剩下的空格依然为连通的.把问题反过来,其实就是求tot-k的连通图.dfs:在搜索过的空格中做个标记,同时更新连通个数. 代码如下: #include<cstdio>//hdu3183 CodeForces 377A dfs #include<cstring> #include<cmath&g…
K - Ancient Messages Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVA 1103 Appoint description:   Description In order to understand early civilizations, archaeologists often study texts written in anc…
http://blog.csdn.net/snowy_smile/article/details/49924965 D. Igor In the Museum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Igor is in the museum and he wants to see as many pictures as…
本文基于leetcode的200.岛屿数量(题目…
本文以Leetcode中695.岛屿的最大面积题目为基础进行展开(题目…
D. Lakes in Berland time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The map of Berland is a rectangle of the size n × m, which consists of cells of size 1 × 1. Each cell is either land or…