- 博客(219)
- 收藏
- 关注
原创 hdu 3265 线段树+扫描线
虽然也是矩形面积并~但让我更深刻了理解了~~本来想的是将大矩形正常打标记,将小矩形反向打标记就是下面的是-1上面是1~~发现样例过不去~~发现思想错了~~~只能分割成小矩形~~#include #include #include #include #define lson pos<<1#define rson pos<<1|1using namespace std;con
2013-07-29 18:43:41
1135
原创 hdu 1828 线段树+扫描线
矩形周长和~#include #include #include #include #define lson pos<<1#define rson pos<<1|1using 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
1140
原创 hdu 1542 线段树+扫描线+离散化~~
第一道额~~理解了好久~思路基本都是网上的~#include #include #include #include #include #define lson pos<<1#define rson pos<<1|1using namespace std;const int MAXN=1000005;struct line{ double l,r,h; i
2013-07-29 12:48:38
869
原创 hdu 2871 线段树+区间合并 好题
很综合的一道题额~考二分 不过 没用在线段树上~~#include #include #include #include #define lson pos<<1#define rson pos<<1|1using namespace std;const int MAXN=50005;int blocks[MAXN*2];struct node{ int l,r;
2013-07-28 16:30:27
1048
原创 hdu 3397 线段树+区间合并+懒惰标记 好题
Sequence operationTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4603 Accepted Submission(s): 1338Problem Descriptionlxhgww
2013-07-28 13:51:03
1330
原创 hdu3308 线段树 区间合并
~~#include #include #include #define lson pos<<1#define rson pos<<1|1using namespace std;const int MAXN=100005;struct node{ int l,r; int msum; int lsum,rsum; int mid() {
2013-07-27 17:39:08
720
原创 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
689
原创 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): 1566Problem Description
2013-07-27 12:58:41
1017
原创 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
902
原创 hdu 4614 线段树+二分~
Vases and FlowersTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 728 Accepted Submission(s): 251Problem Description Alice is
2013-07-27 09:14:54
1391
原创 hdu 4607 求树的直径
分析后就是求树的直径两次bfs即可证明: 树的直径是指树的最长简单路。求法: 两遍BFS :先任选一个起点BFS找到最长路的终点,再从终点进行BFS,则第二次BFS找到的最长路即为树的直径; 原理: 设起点为u,第一次BFS找到的终点v一定是树的直径的一个端点 证明: 1) 如果u 是直径上的点,则v显然是直径的终点(因为如果v不
2013-07-24 11:16:21
1952
原创 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
1317
3
原创 hdu1067 bfs
GapTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 448 Accepted Submission(s): 249Problem DescriptionLet's play a card game
2013-07-22 15:23:10
1868
原创 *hdu 2437 DFS
个人感觉是很好的一道题~~#include #include #include #define INF 0x3f3f3f3fusing 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
1060
原创 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
960
原创 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
669
原创 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
993
原创 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
998
原创 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
762
原创 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
1033
原创 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
1624
原创 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
848
原创 poj2112 二分+最大流
Optimal MilkingTime Limit : 4000/2000ms (Java/Other) Memory Limit : 60000/30000K (Java/Other)Total Submission(s) : 1 Accepted Submission(s) : 1Problem DescriptionFJ has moved his K
2013-07-18 21:27:24
1112
原创 SPOJ 13041 网络流+二分
SPOJ Problem Set (classical)13041. The Black RidersProblem 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
1044
原创 hdu3849 求桥
注意字符的处理 还有特殊情况,如果原图不连通,输出0/******************************无向图******************************/#include #include #include #include #include #include #define INF 0x3f3f3f3f#define BUG printf("h
2013-07-17 16:47:53
1577
转载 图的割点、桥与双连通分支
图的割点、桥与双连通分支转自:https://www.byvoid.com/blog/biconnect/[点连通度与边连通度]在一个无向连通图中,如果有一个顶点集合,删除这个顶点集合,以及这个集合中所有顶点相关联的边以后,原图变成多个连通块,就称这个点集为割点集合。一个图的点连通度的定义为,最小割点集合中的顶点数。类似的,如果有一个边集合,删除这个边集合以后,原图变成多个连通
2013-07-17 09:18:03
746
原创 hdu 4005 双连通
The warTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 1588 Accepted Submission(s): 328Problem DescriptionIn the war, the int
2013-07-16 12:46:52
934
原创 双指针移动
Problem DescriptionOne 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
662
原创 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
1892
原创 hdu 4044 树形dp
GeoDefenseTime Limit: 12000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 417 Accepted Submission(s): 175Problem DescriptionTower defense is
2013-07-12 10:32:15
1074
原创 hdu1561树形dp 01背包
The more, The BetterTime Limit : 6000/2000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 1 Accepted Submission(s) : 1Problem DescriptionACboy很喜欢玩一种战略
2013-07-11 15:05:38
1018
原创 hdu1011树形dp
Starship TroopersTime Limit : 10000/5000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 1 Accepted Submission(s) : 1Problem DescriptionYou, the leader
2013-07-11 13:22:02
707
原创 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
738
原创 负二进制
while (value != 0 ) /*短除法*/ { ans [ ++ top ] = value % (- 2 ); value /= (- 2 ); if (ans [ top ] == - 1 ) /*余数应该为1而不是-1*/
2013-07-10 16:04:19
923
原创 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
911
1
原创 hdu3395费用流
还不会km啊~#include #include #include #include #define inf 0x3f3f3f3f#define MAXN 3000#define MAXM 30000using namespace std;struct node{ int u,v,f,c;};node e[MAXM];int first[MAXN],next[M
2013-07-09 14:20:39
633
原创 HDU3315 费用流
My BruteTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 492 Accepted Submission(s): 180Problem DescriptionSeaco is a beautifu
2013-07-09 13:32:21
1712
原创 hdu3667 最小费用流
拆边1,3,5,7。。建图即可#include #include #include #include #define inf 0x3f3f3f3f#define MAXN 2000#define MAXM 50000using namespace std;struct node{ int u,v,f,c;};node e[MAXM];int first[MAXN
2013-07-09 10:42:12
776
原创 hdu4309枚举+最大流
http://acm.hdu.edu.cn/showproblem.php?pid=4309看了看别人的报告~~感觉二进制枚举很巧妙,学习了,。。#include #include #include #define MAXN 2000#define MAXM 20000#define inf 0x3f3f3f3fusing namespace std;struct node
2013-07-09 09:38:13
926
原创 hdu3468 最大流/二分匹配+BFS
Treasure HuntingTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 903 Accepted Submission(s): 228Problem DescriptionDo you lik
2013-07-08 21:28:48
1817
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人