ACM
Dovahkiin_
这个作者很懒,什么都没留下…
展开
-
HDU1459 Power Network 【多源多汇最大流】
对于多源多汇问题,解决方法是建立一个超级源点只连接所有源点,建立一个超级汇点只连接所有汇点这一题节点从0到n-1,可以让节点的值+1,然后让0作为超级源点,让n+1作为超级汇点对于Init()函数,改变参数让s=0,让t=n+1即可#include<cstdio>#include<cstring>#include<queue>using n...原创 2017-11-13 17:36:25 · 372 阅读 · 0 评论 -
NYOJ116 士兵杀敌(二) 单点更新+区间求和
#include<bits/stdc++.h>using namespace std;const int MAXNODE=4000000+100;const int MAXN=2e6+10;struct NODE{ //int value; //value表示单点值 int grade; //grade表示掌控区间的最大值 int left,right;}...原创 2017-11-10 13:41:20 · 170 阅读 · 0 评论 -
POJ3468 A Simple Problem with Integers 区间更新
#include<cstdio>#include<istream>using namespace std;typedef long long ll;const int MAX=1e5+10;//#define lson l,m,rt<<1//#define rson m+1,r,rt<<1|1ll sum[MAX<<...原创 2017-11-10 13:44:44 · 183 阅读 · 0 评论 -
HDU3549 Flow Problem
#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<iostream>#include<queue>#define inf 0x3fffffffconst int maxn=20; using names...原创 2017-11-10 15:16:16 · 264 阅读 · 0 评论 -
HDU1166 敌兵布阵 单点更新+区间求和
对于同样的单点更新和区间求和功能,树状数组空间上优于线段树,且代码更简便。 #include<cstdio>#include<cstring>using namespace std;int N,c[50005];int lowbit (int i){ return i&(-i);}//让点i值加value void add(int i...原创 2017-11-10 15:26:42 · 172 阅读 · 0 评论 -
HDU1251 统计难题
第一次见到 以输入空行结束 学到了#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>using namespace std;int trie[400001][26],len,root,tot,sum[400001]; char s[11];//...原创 2017-11-11 11:09:46 · 184 阅读 · 0 评论 -
Codevs4189 字典
#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>using namespace std;int trie[1600001][26],len,root,tot,sum[1600001]; char s[11];//这里的s设为全局变量,插入和查询都...原创 2017-11-11 11:36:14 · 211 阅读 · 0 评论 -
POJ1273 Drainage Ditches【dinic算法】
#include<cstdio>#include<cstring>#include<queue>using namespace std;const int INF=1e9;const int maxn=200+10; const int maxm=400+10;struct Edge{ Edge(){} Edge(int fr...原创 2017-11-13 16:33:19 · 211 阅读 · 0 评论 -
Gym 101606E 【贪心+sort】
#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<iostream>#define INF 0x3fffffffconst int maxn=5000+10; using namespace std;typedef...原创 2017-11-13 16:58:09 · 414 阅读 · 0 评论 -
HDU1754 I Hate It 单点更新+区间求最值
//线段树模版#include<bits/stdc++.h>using namespace std;const int MAXNODE=1<<19;const int MAXN=2e6+10;struct NODE{ int value; //这里的value表示单点值,取左右儿子的最大值 int left,right;}node[MAXNODE];...原创 2017-11-10 13:37:54 · 150 阅读 · 0 评论