hdu5925 Coconuts】的更多相关文章

比完看acdream说这题是签到题 怎么都不会写 我现在补完也觉得 这不是傻逼题么 我我这个这么快5题的人真的不应该啊 #include<bits/stdc++.h> using namespace std; typedef long long ll; #define sz(X) ((int)X.size()) const int MAXN = 505; const int INF = 0x3f3f3f3f; int R,C,n; int dir[][4] = { {1,0}, {-1,0},…
题意:一张n*m的网格图(n和m可以达到10^9),其中K个点是障碍物(不超过200个),问你没有被障碍物占据的点形成了几个连通块?并且输出各个连通块的大小. 容易证明,大小超过40000的连通块最多只有一个.于是可以从每个与障碍物邻接的非障碍点出发bfs,限制步数不超过40000,这样就可以找到所有小的连通块.最后如果n*m-K-小的连通块的总大小不等于0,则剩下的就是那个大的连通块的大小. 用map打标记进行判重. #include<cstdio> #include<queue>…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5925 Problem Description TanBig, a friend of Mr. Frog, likes eating very much, so he always has dreams about eating. One day, TanBig dreams of a field of coconuts, and the field looks like a large chessb…
Coconuts Time Limit: 9000/4500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description TanBig, a friend of Mr. Frog, likes eating very much, so he always has dreams about eating. One day, TanBig dreams of a field of coconuts…
Coconuts Time Limit: 9000/4500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 524    Accepted Submission(s): 151 Problem Description TanBig, a friend of Mr. Frog, likes eating very much, so he always has dreams abou…
A group of n castle guards are voting to determine whether African swallows can carry coconuts. While each guard has his own personal opinion on the matter, a guard will often vote contrary to his beliefs in order to avoid disagreeing with the votes…
题目链接: D - Coconuts  HDU - 5925 题目大意:首先是T组测试样例,然后给你n*m的矩阵,原先矩阵里面都是白色的点,然后再输入k个黑色的点.这k个黑色的点可能会使得原先白色的点分成多个联通块,然后问你白色联通块的个数和每一个连通块里面白色的点的个数. 具体思路:输入的点坐标比较大,但是个数比较小,所以离散化坐标就可以了.标记每一个整块里面的白色的点的个数就可以了. AC代码: #include<bits/stdc++.h> using namespace std; #…
Description The short story titled Coconuts, by Ben Ames Williams, appeared in the Saturday Evening Post on October 9, 1926. The story tells about five men and a monkey who were shipwrecked on an island. They spent the first night gathering coconuts.…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5925 Coconuts Time Limit: 9000/4500 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) 问题描述 TanBig, a friend of Mr. Frog, likes eating very much, so he always has dreams about eating. One day, Ta…
TanBig, a friend of Mr. Frog, likes eating very much, so he always has dreams about eating. One day, TanBig dreams of a field of coconuts, and the field looks like a large chessboard which has R rows and C columns. In every cell of the field, there i…