07 2014 档案

2014上海邀请赛D 二分匹配匈牙利 行列建图模板
摘要:1 #include 2 #include 3 int n,n1,n2,link[1255],y[1255],g[1255][1255],mapl[55][55],mapr[55][55]; 4 char map[55][55]; 5 int dfs(int x) 6 { ... 阅读全文

posted @ 2014-07-31 17:00 xiao_xin 阅读(130) 评论(0) 推荐(0)

hdu2063 最大匹配 邻接表实现匈牙利算法
摘要:1 #include 2 #include 3 int w,m, head[10005],point[10005],next[10005],y[10005],link[10005],now; 4 void add(int x,int y) 5 { 6 //now是边的数目 7 ne... 阅读全文

posted @ 2014-07-29 22:57 xiao_xin 阅读(145) 评论(0) 推荐(0)

hdu1156两颗线段树 点修改求和(数组存放扫描线)
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 struct dian 6 { 7 int x,y; 8 }s[200005]; 9 int leftnum[500005],rightnum[500005... 阅读全文

posted @ 2014-07-28 03:04 xiao_xin 阅读(138) 评论(0) 推荐(0)

hdu1542 二维如何转化为线段树
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 struct LINE 6 { 7 double x,ydown,yup; 8 int flag; 9 bool operator=1)32 ... 阅读全文

posted @ 2014-07-27 01:48 xiao_xin 阅读(98) 评论(0) 推荐(0)

hdu3333 线段树点修改区间求和(离散化判重)+离线算法
摘要:1 #include 2 #include 3 int ql,qr,p; 4 long long fsum,v; 5 int f[100005],g[100005],a[100005],b[100005]; 6 int r[100005],l[100005],hash[100005],... 阅读全文

posted @ 2014-07-25 03:12 xiao_xin 阅读(188) 评论(0) 推荐(1)

hdu1394 线段树点修改区间求和
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int p,v,ql,qr,fsum,sumv[10005],d[10005],a[10005]; 7 void update(int o,int l,int ... 阅读全文

posted @ 2014-07-24 19:47 xiao_xin 阅读(132) 评论(0) 推荐(0)

hdu1540 线段树点修改(较难)
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int ql,qr,x,n,ll[150005],rl[150005],a[150005]; 7 stacks; 8 void build(in... 阅读全文

posted @ 2014-07-24 01:32 xiao_xin 阅读(139) 评论(0) 推荐(0)

hdu1698 线段树区间赋值
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int yy2,yy1,v,fsum; 8 int sumv[1000005],setv[1000005]; 9 10 void main... 阅读全文

posted @ 2014-07-23 12:36 xiao_xin 阅读(157) 评论(0) 推荐(0)

poj2528 线段树区间修改(加值)
摘要:1 #include 2 #include 3 int addv[100005],minv[100005],fmin,y1,y2,v,l[20005],d[20005],len[20005]; 4 int min(int x,int y) 5 { 6 if (x=r) addv[o]+=v... 阅读全文

posted @ 2014-07-22 23:39 xiao_xin 阅读(119) 评论(0) 推荐(0)

hdu3306 矩阵快速幂
摘要:1 #include 2 #include 3 #define MOD 10007 4 int main() 5 { 6 int n,x,y,i,j,k,doit[5][5],temp[5][5],a[5][2]; 7 while (~scanf("%d%d%d",&n,&x,&y... 阅读全文

posted @ 2014-07-22 16:10 xiao_xin 阅读(125) 评论(0) 推荐(0)

hdu1074 状态压缩dp
摘要:1 #include 2 #include 3 char s[20][105]; 4 int ded[20],day[20],hash[40000]; 5 struct s 6 { 7 int time,pre,lost; 8 }dp[40000]; 9 void Print(int s... 阅读全文

posted @ 2014-07-22 14:17 xiao_xin 阅读(103) 评论(0) 推荐(0)

hdu1400 状态压缩dp
摘要:1 #include 2 #include 3 long long result[15][15],dp[15][2050]; 4 int n,m,t; 5 long long dfs(int l,int state) 6 { 7 int i,j,judge,flag,last; 8 ... 阅读全文

posted @ 2014-07-21 23:38 xiao_xin 阅读(158) 评论(0) 推荐(0)

hdu1059 二进制优化多重背包
摘要:1 #include 2 int max(int x,int y) 3 { 4 if (x>y) return x; 5 return y; 6 } 7 int v[105],w[105],ans[1000005]; 8 int main() 9 {10 int t=0,f... 阅读全文

posted @ 2014-07-18 18:07 xiao_xin 阅读(109) 评论(0) 推荐(0)

hdu1025 dp+二分查找 nlogn最长上升子序列
摘要:1 #include 2 #include 3 int a[500005],b[500005],d[500005]; 4 void sort(int l,int r) 5 { 6 int i=l,j=r,x=a[(i+j)/2],y; 7 while (id[maxlen])41 ... 阅读全文

posted @ 2014-07-18 14:32 xiao_xin 阅读(172) 评论(0) 推荐(0)

hdu1024 dp+滚动数组
摘要:1 #include 2 #include 3 int dp[1000005],pre[1000005],a[1000005]; 4 int main() 5 { 6 int max1; 7 int i,j,n,m; 8 while (~scanf("%d%d",&m,&n... 阅读全文

posted @ 2014-07-18 11:49 xiao_xin 阅读(110) 评论(0) 推荐(0)

hdu1535 spfa反向表示多到一
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 struct Edge 7 { 8 int to; //边终点 9 int w; //边值10 int next;//结构体模拟链... 阅读全文

posted @ 2014-07-17 17:24 xiao_xin 阅读(129) 评论(0) 推荐(0)

hdu2145 邻接表spfa
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 struct Edge 7 { 8 int to; //边终点 9 int w; //边值10 int next;//结构体模拟链... 阅读全文

posted @ 2014-07-17 17:22 xiao_xin 阅读(106) 评论(0) 推荐(0)

hdu1671 字典树
摘要:1 #include 2 #include 3 int sz,ch[100005][30],val[100005]; 4 void insert(char *s) 5 { 6 int u=0,i,len=strlen(s); 7 for (i=0;i<len;i++) 8 ... 阅读全文

posted @ 2014-07-16 17:53 xiao_xin 阅读(85) 评论(0) 推荐(0)

hdu1247 字典树
摘要:1 #include 2 #include 3 int ch[50005][100],sz=1,val[50005]; 4 char s[50005][105]; 5 void insert(char *s) 6 { 7 int i,u=0,len=strlen(s),c; 8 ... 阅读全文

posted @ 2014-07-16 17:52 xiao_xin 阅读(84) 评论(0) 推荐(0)

hdu1806 RMQ
摘要:1 #include 2 int d[100005][50]; 3 int max(int a,int b) 4 { 5 if (a>b) return(a); 6 return(b); 7 } 8 int rmq(int l,in... 阅读全文

posted @ 2014-07-16 17:46 xiao_xin 阅读(105) 评论(0) 推荐(0)

hdu1754 线段树点修改
摘要:1 #include 2 int ql,qr,p,v,minv[1000005]; 3 int max(int x,int y) 4 { 5 if (x>y) return(x); 6 return(y); 7 } 8 int qu... 阅读全文

posted @ 2014-07-16 17:34 xiao_xin 阅读(93) 评论(0) 推荐(0)

hdu1166 树状数组
摘要:1 #include 2 int n,c[1000005]; 3 int lowbit(int x) 4 { 5 return(x&-x); 6 } 7 void add(int x,int d) 8 { 9 while (x0)1... 阅读全文

posted @ 2014-07-16 17:30 xiao_xin 阅读(86) 评论(0) 推荐(0)

hdu1102 最小生成树
摘要:1 #include 2 int a[10005],p[10005],q[10005],father[10005]; 3 int find(int x) 4 { 5 if (father[x]!=x) father[x]=find(father[x]); 6 return(fath... 阅读全文

posted @ 2014-07-16 16:54 xiao_xin 阅读(84) 评论(0) 推荐(0)

hdu2544 dijkstra
摘要:1 #include 2 #define max 100000000; 3 int main() 4 { 5 int n,m,i,j,k,min,a,b,c,hash[1005],ar[1005],length[105][105]; 6 while (~scanf("%d%d",&... 阅读全文

posted @ 2014-07-16 16:51 xiao_xin 阅读(87) 评论(0) 推荐(0)

hdu1711 kmp
摘要:1 #include 2 #include 3 int a[1000005],b[1000005],next[100005]; 4 int main() 5 { 6 int t,i,j,n,m; 7 while (~scanf("%d",&t)) 8 while (t--)... 阅读全文

posted @ 2014-07-16 16:47 xiao_xin 阅读(82) 评论(0) 推荐(0)

hdu2202 凸包+旋转卡壳
摘要:1 #include 2 #include 3 typedef struct dian 4 { 5 int x,y; 6 }; 7 dian p[50005],ch[50005]; 8 double area(int i,int j,int k) 9 {10 double a,b,... 阅读全文

posted @ 2014-07-16 16:39 xiao_xin 阅读(135) 评论(0) 推荐(0)

hdu1849 1850 1851 nim博弈
摘要:1 #include 2 int main() 3 { 4 int n,k,a,i; 5 while (~scanf("%d",&n)&&n!=0) 6 { 7 k=0; 8 for (i=1;i 2 int main() 3 { 4 ... 阅读全文

posted @ 2014-07-16 16:32 xiao_xin 阅读(94) 评论(0) 推荐(0)

hdu1527 威佐夫博弈
摘要:1 #include 2 #include 3 int main() 4 { 5 int t,n,m,x; 6 while (~scanf("%d%d",&n,&m)) 7 { 8 if (n>m) {t=m; m=n; n=t; } 9 t... 阅读全文

posted @ 2014-07-16 16:30 xiao_xin 阅读(116) 评论(0) 推荐(0)

hdu1348 凸包
摘要:1 #include 2 #include 3 int x[100005],y[100005],ch[100005]; 4 void sort(int l,int r) 5 { 6 int i,j,xx,yy,x1; 7 i=l; j=r; 8 xx=x[(i+j)/2];... 阅读全文

posted @ 2014-07-16 16:28 xiao_xin 阅读(80) 评论(0) 推荐(0)

hdu1251 字典树
摘要:1 #include 2 #include 3 int sz=1,father[1000005],val[1000005],ch[1000005][30]; 4 void insert(char *s) 5 { 6 int u=0,i,len=strlen(s); 7 for (i... 阅读全文

posted @ 2014-07-16 16:27 xiao_xin 阅读(87) 评论(0) 推荐(0)

hdu1242 优先队列bfs
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 typedef struct dian 6 { 7 friend bool operatorn2.time);10 }11 int x,y,time;12 }... 阅读全文

posted @ 2014-07-16 16:26 xiao_xin 阅读(106) 评论(0) 推荐(0)

hdu1028 母函数
摘要:1 #include 2 #include 3 int main() 4 { 5 int i,j,k,n,m,c1[10005],c2[10005]; 6 while (~scanf("%d",&n)) 7 { 8 for (i=0;i<=n;i++) ... 阅读全文

posted @ 2014-07-16 16:25 xiao_xin 阅读(94) 评论(0) 推荐(0)

hdu2155 dp
摘要:1 #include 2 #include 3 int h[10005],xl[10005],xr[10005],dp[10005][5]; 4 int min(int a,int b) 5 {if (a=1;j--)41 if (xl[j]=1;j--)48 ... 阅读全文

posted @ 2014-07-16 16:23 xiao_xin 阅读(122) 评论(0) 推荐(0)

hdu2181 哈密尔顿dfs
摘要:1 #include 2 #include 3 int hash[25],map[25][5],m,k,jilu[25]; 4 void dfs(int now,int step) 5 { 6 int i,judge; 7 jilu[step]=now; 8 if (ste... 阅读全文

posted @ 2014-07-16 16:21 xiao_xin 阅读(97) 评论(0) 推荐(0)

hdu3934 凸包
摘要:1 #include 2 #include 3 typedef struct dian 4 { 5 int x,y; 6 }; 7 dian p[50005],ch[50005]; 8 double area(int i,int j,int k) 9 {10 double a,b,... 阅读全文

posted @ 2014-07-16 16:18 xiao_xin 阅读(125) 评论(0) 推荐(0)

hdu2208 dfs+并查集
摘要:1 #include 2 #include 3 int n,m,min,father[15],map[15][15]; 4 int find(int i) 5 { 6 if (father[i]!=i) return(find(father[i])); 7 return(fathe... 阅读全文

posted @ 2014-07-16 16:15 xiao_xin 阅读(121) 评论(0) 推荐(0)

hdu2669 扩展欧几里得
摘要:1 #include 2 int exgcd(__int64 a,__int64 b,__int64 &x,__int64 &y) 3 { 4 __int64 t,r; 5 if (b==0){ 6 x=1; y=0; 7 return(a); 8 ... 阅读全文

posted @ 2014-07-16 16:13 xiao_xin 阅读(118) 评论(0) 推荐(0)

hdu4828 卡特兰数+乘法逆元
摘要:1 #include 2 #include 3 #include 4 #include 5 #define MAX 1000003 6 #define MOD 1000000007 7 #define LL long long 8 using namespace std; 9 10 __i... 阅读全文

posted @ 2014-07-16 16:10 xiao_xin 阅读(169) 评论(0) 推荐(0)

hdu2227 树状数组
摘要:1 #include 2 #include 3 #define MOD 1000000007 4 __int64 ans[100005],c[100005]; 5 int a[100005],wei[100005],n; 6 void sort(int l,int r) 7 { 8 int... 阅读全文

posted @ 2014-07-16 16:05 xiao_xin 阅读(112) 评论(0) 推荐(0)

hdu1285 拓扑序
摘要:1 #include 2 #include 3 int map[505][505],into[505],w[505]; 4 int main() 5 { 6 int n,m,u,v,i,j,k; 7 while (~scanf("%d%d",&n,&m)) 8 { 9 ... 阅读全文

posted @ 2014-07-16 16:02 xiao_xin 阅读(120) 评论(0) 推荐(0)

hdu1010 dfs
摘要:1 #include 2 #include 3 int xx[]={0,0,1,-1}; 4 int yy[]={1,-1,0,0}; 5 int used[15][15]; 6 char map[15][15]; 7 int n,m,t,x2,y2; 8 typedef struct dian ... 阅读全文

posted @ 2014-07-16 16:00 xiao_xin 阅读(96) 评论(0) 推荐(0)

hdu2063 最大匹配
摘要:1 #include 2 #include 3 int g[505][505],y[505],link[505],n1,n2; 4 int find(int x) 5 { 6 int i; 7 for (i=1;i<=n2;i++) 8 if (g[x][i]==1&&y... 阅读全文

posted @ 2014-07-16 15:57 xiao_xin 阅读(94) 评论(0) 推荐(0)

hdu2444 二分图匹配(匈牙利算法)
摘要:1 #include 2 #include 3 int number[505],dian1[505],dian2[505],y[505],link[505],hash[505]; 4 int f[505][505],g[505][505]; 5 int n1,n2; 6 int doit(int ... 阅读全文

posted @ 2014-07-16 15:56 xiao_xin 阅读(125) 评论(0) 推荐(0)

hdu2276 快速矩阵幂
摘要:1 #include 2 #include 3 char s[105]; 4 int ans[105],temp[105],temp1[105][105],a[105][105]; 5 int main() 6 { 7 int i,j,k,n,m; 8 while (~scanf(... 阅读全文

posted @ 2014-07-16 15:01 xiao_xin 阅读(101) 评论(0) 推荐(0)

hdu1043 A*+康托展开
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 typedef struct node 8 { 9 int f,g,h; 10 int x,y; 11 ... 阅读全文

posted @ 2014-07-16 14:53 xiao_xin 阅读(251) 评论(0) 推荐(0)

hdu1051二维动规
摘要:1 #include 2 int a[100005],b[100005],maxlen[100005]; 3 void sort(int l,int r) 4 { 5 int i,j,x,y,x1,y1; 6 i=l; j=r; 7 x=a[(i+j)/2]; x1=b[(... 阅读全文

posted @ 2014-07-16 14:51 xiao_xin 阅读(98) 评论(0) 推荐(0)

hdu2513区间动规
摘要:1 #include 2 #include 3 #define INF 1000000000 4 int hash[45][45][45][45],judge[45][45][45][45],map[45][45],m,n; 5 int dp(int i,int j,int h,int w) 6 ... 阅读全文

posted @ 2014-07-16 14:46 xiao_xin 阅读(154) 评论(0) 推荐(0)

hdu2515
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 int hash[100005],k[100005],a[100005]; 6 int main() 7 { 8 int n,sum,i,j,x,sum1,t; 9 ... 阅读全文

posted @ 2014-07-16 14:44 xiao_xin 阅读(124) 评论(0) 推荐(0)

hdu2517 区间动规
摘要:1 #include 2 #include 3 #include 4 #define inf 1000000000 5 int hash[10][10][10][10][20]; 6 int s[10][10][10][10],fsum[10][10][10][10]; 7 int dp(int ... 阅读全文

posted @ 2014-07-16 14:41 xiao_xin 阅读(122) 评论(0) 推荐(0)

hdu2527 Huffman Coding
摘要:#include#include#includeusing namespace std;char s[100005];int t;struct dian{ friend bool operator n2.x); } int node,l,r,x;};dian n[105],n1... 阅读全文

posted @ 2014-07-16 14:37 xiao_xin 阅读(105) 评论(0) 推荐(0)

hdu2531 bfs
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 int xx[4]={0,0,1,-1}; 6 int yy[4]={1,-1,0,0}; 7 int used[125][125],hash[125][125],sum,n,m; ... 阅读全文

posted @ 2014-07-16 14:33 xiao_xin 阅读(114) 评论(0) 推荐(0)

hdu1299
摘要:1 #include 2 #include 3 int vis[100005],prime[100005]; 4 int main() 5 { 6 int cnt,dd,i,j,t,T,n,ans,temp; 7 cnt=0; dd=int(1.0*sqrt(1000000000.... 阅读全文

posted @ 2014-07-16 14:29 xiao_xin 阅读(239) 评论(0) 推荐(0)

hdu2534
摘要:1 #include 2 long long gcd(long long a,long long b) 3 { 4 if (b==0) return a; 5 return(gcd(b,a%b)); 6 } 7 int main() 8 { 9 long long m,n;... 阅读全文

posted @ 2014-07-16 14:28 xiao_xin 阅读(76) 评论(0) 推荐(0)

hdu2412树形dp
摘要:#include#include#include#includeusing namespace std;int son1[205],f[205][205],dp[205][2],dup[205][2],hash[205];char s[205][105],s1[105],s2[105];void d... 阅读全文

posted @ 2014-07-16 14:25 xiao_xin 阅读(127) 评论(0) 推荐(0)

hdu1011 树形dp(背包)
摘要:1 #include 2 #include 3 int max(int a,int b) 4 { 5 if (a>b) return a; 6 return b; 7 } 8 int m; 9 int dp[150][150],son[150],bug[150],pos[150],... 阅读全文

posted @ 2014-07-16 14:16 xiao_xin 阅读(108) 评论(0) 推荐(0)

导航