- 博客(219)
- 收藏
- 关注
原创 hdu 3265 线段树+扫描线
虽然也是矩形面积并~但让我更深刻了理解了~~ 本来想的是将大矩形正常打标记,将小矩形反向打标记就是下面的是-1上面是1~~发现样例过不去~~发现思想错了~~~ 只能分割成小矩形~~ #include #include #include #include #define lson pos<<1 #define rson pos<<1|1 using namespace std; con
2013-07-29 18:43:41 1112
原创 hdu 1828 线段树+扫描线
矩形周长和~ #include #include #include #include #define lson pos<<1 #define rson pos<<1|1 using namespace std; const int MAXN=30000; struct line { int l,r,h,f; line(int a=0,int b=0,int c=0,int
2013-07-29 15:52:03 1116
原创 hdu 1542 线段树+扫描线+离散化~~
第一道额~~理解了好久~ 思路基本都是网上的~ #include #include #include #include #include #define lson pos<<1 #define rson pos<<1|1 using namespace std; const int MAXN=1000005; struct line { double l,r,h; i
2013-07-29 12:48:38 850
原创 hdu 2871 线段树+区间合并 好题
很综合的一道题额~考二分 不过 没用在线段树上~~ #include #include #include #include #define lson pos<<1 #define rson pos<<1|1 using namespace std; const int MAXN=50005; int blocks[MAXN*2]; struct node { int l,r;
2013-07-28 16:30:27 1022
原创 hdu 3397 线段树+区间合并+懒惰标记 好题
Sequence operation Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4603 Accepted Submission(s): 1338 Problem Description lxhgww
2013-07-28 13:51:03 1307 1
原创 hdu3308 线段树 区间合并
~~ #include #include #include #define lson pos<<1 #define rson pos<<1|1 using namespace std; const int MAXN=100005; struct node { int l,r; int msum; int lsum,rsum; int mid() {
2013-07-27 17:39:08 695
原创 poj3667 线段树+区间合并
第一道额~~ #include #include #include using namespace std; const int MAXN=100005; struct node { int l,r; int lsum,rsum,msum; int mid() { return (l+r)>>1; } }; node tree[MAX
2013-07-27 15:58:13 671
原创 hdu 4027 线段树
Can you answer these queries? Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 6849 Accepted Submission(s): 1566 Problem Description
2013-07-27 12:58:41 988
原创 hdu 3577 线段树,成段更新
这个题有一点要考虑到,就是某人从a站坐到b站,他在b站就下车了,他在车上乘坐的区间为a到b-1。 #include #include #include using namespace std; const int MAXN=1000005; struct node { int l,r; int sum; int lazy; int mid() {
2013-07-27 10:54:22 880
原创 hdu 4614 线段树+二分~
Vases and Flowers Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 728 Accepted Submission(s): 251 Problem Description Alice is
2013-07-27 09:14:54 1360
原创 hdu 4607 求树的直径
分析后就是求树的直径两次bfs即可 证明: 树的直径是指树的最长简单路。求法: 两遍BFS :先任选一个起点BFS找到最长路的终点,再从终点进行BFS,则第二次BFS找到的最长路即为树的直径; 原理: 设起点为u,第一次BFS找到的终点v一定是树的直径的一个端点 证明: 1) 如果u 是直径上的点,则v显然是直径的终点(因为如果v不
2013-07-24 11:16:21 1922
原创 hdu 4604 二分+dp
好 蛋疼 终于ac了~~ 实际就是求从某个点开始,的最长不降子序列和最长不升子序列之和 减去两个中重复的数字~ #include #include #include using namespace std; const int inf=0x3f3f3f3f; int num[100005]; int q1[100005]; int q2[100005]; int res[100005];
2013-07-24 10:16:56 1294 4
原创 hdu1067 bfs
Gap Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 448 Accepted Submission(s): 249 Problem Description Let's play a card game
2013-07-22 15:23:10 1850
原创 *hdu 2437 DFS
个人感觉是很好的一道题~~ #include #include #include #define INF 0x3f3f3f3f using namespace std; const int MAXN=1005; const int MAXM=20005; struct node { int u,v,w; }; node edge[MAXM]; int first[MAXN],nex
2013-07-22 13:00:54 1036
原创 hdu3500 DFS
两个DFS()~~~ #include #include #include using namespace std; char map[10][10]; int xx[4]={0,1,0,-1}; int yy[4]={1,0,-1,0}; struct node { int x,y; int dir; }; node res[10000]; void fling(int
2013-07-21 18:16:44 940
原创 hdu 2821 dfs
以前就做过~~但是不知道怎么地 一直wa,,今天重新搞了一遍~~ 一直wa~~发现 只输入过程忘了~~r c~~ #include #include #include using namespace std; int n,m; int map[50][50]; int vis[50][50]; int xx[4]={0,1,0,-1}; int yy[4]={1,0,-1,0}; int
2013-07-21 15:27:25 642
原创 hdu3290 DFS
也算树形dp?~~ #include #include #include #include using namespace std; const int MAXN=30000; const int MAXM=50000; struct node { int u,v; }; node edge[MAXM]; int first[MAXN],next[MAXM]; int cc; i
2013-07-21 13:59:25 976
原创 hdu 2782 DFS
时间4s~~~爆搜~~ #include #include using namespace std; int map[700][700]; int vis[700][700]; int ansx,ansy; int ansd,anssum; int n,m; int res=0; int xx[4]={0,-1,1,0}; int yy[4]={1,0,0,-1}; void dfs(int
2013-07-21 12:48:01 978
原创 hdu 3360
奇偶染色,将有冲突要求的位置连一条边,求最小点覆盖~~ 有一个主意点必须要双向检查~~ #include #include #include using namespace std; int map[55][55]; int xid[5555]; int yid[5555]; struct node { int u,v; }; node edge[755555]; int fir
2013-07-21 10:26:27 735
原创 hdu 2768 最大独立集
http://acm.hdu.edu.cn/showproblem.php?pid=2768 建图很巧妙吗,把每个孩子拆点,,将有矛盾的两个孩子之间连一条边,当然还有反向边, 求出最大匹配/2;以为前面拆点且有反向边所以求出最大匹配要除以2,,然后用总人数减去即可 #include #include #include #define INF 0x3f3f3f3f #define BUG
2013-07-20 10:48:32 1005
原创 hdu2444 判断二分图+最大匹配
用黑白染色判断二分图。 #include #include #include using namespace std; struct node { int u,v; }; node edge[50000]; int first[300],next[50000]; int cc; int vis[300]; int flag[300]; int linker[300]; inline
2013-07-20 09:55:29 1601
原创 hdu1281 二分匹配
横坐标作左边的,纵坐标作右边的 最大匹配就是能放的棋子,然后枚举k个点 #include #include #include #define INF 0x3f3f3f3f #define BUG printf("here!\n") using namespace std; const int MAXN=300; int map[MAXN][MAXN]; int linkx[MAXN],
2013-07-19 15:52:20 830
原创 poj2112 二分+最大流
Optimal Milking Time Limit : 4000/2000ms (Java/Other) Memory Limit : 60000/30000K (Java/Other) Total Submission(s) : 1 Accepted Submission(s) : 1 Problem Description FJ has moved his K
2013-07-18 21:27:24 1090
原创 SPOJ 13041 网络流+二分
SPOJ Problem Set (classical) 13041. The Black Riders Problem code: AMR12A 'Hush!' said Frodo. 'I think I hear hoofs again.' They stopped suddenly and stood as silent as tree-s
2013-07-18 18:36:25 1027
原创 hdu3849 求桥
注意字符的处理 还有特殊情况,如果原图不连通,输出0 /****************************** 无向图 ******************************/ #include #include #include #include #include #include #define INF 0x3f3f3f3f #define BUG printf("h
2013-07-17 16:47:53 1544 1
转载 图的割点、桥与双连通分支
图的割点、桥与双连通分支 转自:https://www.byvoid.com/blog/biconnect/ [点连通度与边连通度] 在一个无向连通图中,如果有一个顶点集合,删除这个顶点集合,以及这个集合中所有顶点相关联的边以后,原图变成多个连通块,就称这个点集为割点集合。一个图的点连通度的定义为,最小割点集合中的顶点数。 类似的,如果有一个边集合,删除这个边集合以后,原图变成多个连通
2013-07-17 09:18:03 723
原创 hdu 4005 双连通
The war Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 1588 Accepted Submission(s): 328 Problem Description In the war, the int
2013-07-16 12:46:52 909
原创 双指针移动
Problem Description One day, ZHJ came across a warrior novel named Kunlun in library. Soon, ZHJ fall into it. He tells everybody how deeply he loves Kunlun no matter whom he meets. He found it at
2013-07-15 12:46:59 647
原创 hdu1426 数独
http://acm.hdu.edu.cn/showproblem.php?pid=1426 #include #include #include #define INF 0x3f3f3f3f #define BUG printf("here!\n") using namespace std; int map[10][10]; struct node { int x,y; }; n
2013-07-13 12:06:24 1867
原创 hdu 4044 树形dp
GeoDefense Time Limit: 12000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 417 Accepted Submission(s): 175 Problem Description Tower defense is
2013-07-12 10:32:15 1054
原创 hdu1561树形dp 01背包
The more, The Better Time Limit : 6000/2000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 1 Accepted Submission(s) : 1 Problem Description ACboy很喜欢玩一种战略
2013-07-11 15:05:38 995
原创 hdu1011树形dp
Starship Troopers Time Limit : 10000/5000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 1 Accepted Submission(s) : 1 Problem Description You, the leader
2013-07-11 13:22:02 686
原创 hdu2196树形dp
刚开始连树形dp,~~ 树形dp不仅能连dp,还能练dfs.. 练建邻接表额~~ 基本完全参考别人~~~ http://www.cnblogs.com/kuangbin/archive/2012/08/28/2659915.html #include #include #include #define MAXM 20000 #define MAXN 20000 #define I
2013-07-11 11:01:10 721
原创 负二进制
while (value != 0 ) /*短除法*/ { ans [ ++ top ] = value % (- 2 ); value /= (- 2 ); if (ans [ top ] == - 1 ) /*余数应该为1而不是-1*/
2013-07-10 16:04:19 883
原创 hdu2448 费用流
http://acm.hdu.edu.cn/showproblem.php?pid=2448 和那个在地图上回家的差不多~~~ station之间是无向的,port与station是有向的,因为进去就不能出来。 费用流建图,即可 #include #include #include #include #define inf 0x3f3f3f3f #define MAXN 3000
2013-07-09 15:18:23 883 1
原创 hdu3395费用流
还不会km啊~ #include #include #include #include #define inf 0x3f3f3f3f #define MAXN 3000 #define MAXM 30000 using namespace std; struct node { int u,v,f,c; }; node e[MAXM]; int first[MAXN],next[M
2013-07-09 14:20:39 607
原创 HDU3315 费用流
My Brute Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 492 Accepted Submission(s): 180 Problem Description Seaco is a beautifu
2013-07-09 13:32:21 1678
原创 hdu3667 最小费用流
拆边1,3,5,7。。建图即可 #include #include #include #include #define inf 0x3f3f3f3f #define MAXN 2000 #define MAXM 50000 using namespace std; struct node { int u,v,f,c; }; node e[MAXM]; int first[MAXN
2013-07-09 10:42:12 756
原创 hdu4309枚举+最大流
http://acm.hdu.edu.cn/showproblem.php?pid=4309 看了看别人的报告~~感觉二进制枚举很巧妙,学习了,。。 #include #include #include #define MAXN 2000 #define MAXM 20000 #define inf 0x3f3f3f3f using namespace std; struct node
2013-07-09 09:38:13 908
原创 hdu3468 最大流/二分匹配+BFS
Treasure Hunting Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 903 Accepted Submission(s): 228 Problem Description Do you lik
2013-07-08 21:28:48 1794
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人