自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

原创 差分约束系统

#include<iostream> #include<cstring> #include<queue> using namespace std; #define N 1010 #define M 100010 struct graph{ int tot,head[M]; struct edge{ int next; int to,dis; }e...

2019-06-21 18:42:48 165

原创 [十二省联考2019]春节十二响

[十二省联考2019]春节十二响 Description 题目背景 「清明时节雨纷纷,路上行人欲断魂。」 2075 年的清明没有春雨。在漫天飞雪的笼罩下,穿行在冰原间的,只有载着人类微薄希望的雪地车。 遥遥 4.22 光年的征途,对于地球这孤独的旅人而言,恐怕也是无比寂寞的吧。 题目描述 距离苏拉威西只有一百公里了...

2019-06-19 12:59:12 266

原创 最小费用最大流

#include<iostream> #include<queue> #include<cstring> using namespace std; #define N 512 #define inf 0x7fffffff int n,m,x,y,ca,c; struct maxFlowMinCost{ int cap[N][N],cost[N][N]; i...

2019-06-14 21:41:40 204

原创 最大流

#include<iostream> #include<cstring> #include<queue> using namespace std; #define N 50001 #define M 500001 int n,m,x,y,cap; struct dinic{ struct graph{ int tot,head[M]; ...

2019-06-14 21:40:00 130

原创 链式前向星

#include<iostream> using namespace std; #define N 20001 #define M 30001 struct graph{ int tot,head[M]; struct edge{ int next; int to,dis; }ed[M]; void addEdge(int from,int to,int dis){ ...

2019-06-14 19:39:10 140

原创 拓扑排序

#include<iostream> #include<queue> #include<vector> #include<cstring> using namespace std; int n,m,x,y,in[30001]; priority_queue<int>q,*pq; queue<int>ans; vector&l...

2019-06-14 13:24:11 126

原创 割点(割顶)

#include<iostream> #include<vector> #include<stack> #include<cstring> #include<cstdio> using namespace std; #define N 100010 vector<int>l[N],g[N]; int n,m,x,y; int...

2019-06-10 13:11:49 148

原创 缩点

#include<iostream> #include<vector> #include<stack> #include<cstring> #include<cstdio> using namespace std; #define N 100010 vector<int>l[N],g[N]; int n,m,x,y; int...

2019-06-10 13:10:28 142

原创 海明距离-异或值中1的个数

海明距离-异或值中1的个数 Description 对于二进制串a,b,他们之间的海明距离是指两个串异或之后串中1的个数。异或的规则为: 0 XOR 0 = 0 1 XOR 0 = 1 0 XOR 1 = 1 1 XOR 1 = 0 计算两个串之间的海明距离的时候,他们的长度必须相同。现在我们给...

2019-06-05 13:20:30 1085 1

原创 树环转换

树环转换 Description 给定一棵N个节点的树,去掉这棵树的一条边需要消耗值1,为这个图的两个点加上一条边也需要消耗值1。树的节点编号从1开始。在这个问题中,你需要使用最小的消耗值(加边和删边操作)将这棵树转化为环,不允许有重边。 环的定义如下: (1)该图有N个点,N条边。 (...

2019-06-05 13:15:20 423

原创 tajan

#include<iostream> #include<vector> #include<stack> #include<cstring> #include<cstdio> using namespace std; #define N 100010 vector<int>l[N]; int n,m,x,y; int dfn[...

2019-06-05 13:08:27 153

原创 Dijkstra

#include<iostream> #include<vector> #include<queue> #include<cstring> #include<cstdio> using namespace std; #define N 100001 struct Edge{ int y,w; }; struct Node{ ...

2019-05-31 20:59:05 712

原创 SPFA

#include<iostream> #include<vector> #include<queue> #include<cstring> using namespace std; #define N 100001 struct Edge{ int y,w; }; vector<Edge>l[N]; queue<int&g...

2019-05-31 20:58:17 108

原创 最小生成树

#include<iostream> #include<algorithm> using namespace std; #define N 400010 int n,m,x,y,w,tot,sum; struct Edge{ int x,y,w; }e[N]; bool cmp(Edge a,Edge b){ return a.w<b.w; } st...

2019-05-31 20:57:39 137

原创 P2661 信息传递

信息传递 Description 有n个同学(编号为1到n)正在玩一个信息传递的游戏。在游戏里每人都有一个固定的信息传递对象,其中,编号为的同学的信息传递对象是编号为的同学。 游戏开始时,每人都只知道自己的生日。之后每一轮中,所有人会同时将自己当前所知的生日信息告诉各自的...

2019-05-31 20:53:52 141

原创 带权并查集

#include<iostream> #include<cmath> using namespace std; #define N 30001 struct union_Find_Sets{ int fa[N],siz[N],dis[N]; int findFa(int v){ if(fa[v]!=v){ int f...

2019-05-28 18:16:30 137

原创 网络连接

网络连接 Description Bob是一个网络管理员,负责监控计算机网络。他要维护网络内计算机之间的连接的日志。每个连接是双向的。如果两台计算机是直接连接的,或者与同一台计算机互联,则我们称这两台计算机是互联的。有的时候,需要Bob根据日志信息作出判断,确定给出的两台计算机是否直接或间接地互联。 请基于输入信...

2019-05-24 21:59:38 520

原创 并查集

#include<iostream> using namespace std; #define N 20010 int n,m,fa[N],x,y,op; int findFa(int v){return fa[v]==v?v:fa[v]=findFa(fa[v]);} void unionn(int v,int u){fa[v]=u;} int main(){ cin>&g...

2019-05-24 21:00:03 116

原创 SAM

#include<iostream> #include<cstring> #include<vector> #include<cstdio> using namespace std; #define N 2000005 char s[N]; vector<int>l[N]; int size[N]; struct SAM{ #d...

2019-05-18 08:13:51 152

原创 树链剖分

#include<iostream> #include<cstdio> #include<cstring> #include<vector> using namespace std; namespace SLPF{ #define N 100001 int dep[N],fa[N],son[N],id[N],size[N],cost[N],to...

2019-05-13 13:52:40 108

原创 ST+SA求LCP

struct ST{ int dp[600010][51]; void get(int *s,int n){ for(int i=1;i<=n;i++){ dp[i][0]=s[i]; } for(int j=1;j<=(log(n)/l...

2019-05-11 07:45:53 416

原创 manacher

#include<cstdio> #include<cstring> #include<algorithm> #include<iostream> using namespace std; #define N 10000050 int te,p[N+5]; char s[N+5]; #define EXP_CH '@' #define EXP_CH...

2019-04-27 09:24:13 121

原创 双端插入回文自动机

#include<iostream> #include<cstdio> #include<cstring> #include<string> using namespace std; #define sigma 26 #define N 1000010 int l1[N],l2[N]; struct Palindromic_Tree{ in...

2019-04-27 09:23:00 344

原创 回文自动机

#include<iostream> #include<cstdio> #include<cstring> #include<string> using namespace std; #define sigma 26 #define N 1000010 int l1[N],l2[N]; struct Palindromic_Tree{ in...

2019-04-27 09:21:40 108

原创 后缀数组

#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #define N 1000010 using namespace std; char s[N]; int len; //--------begin-------- struct SA { int r...

2019-04-27 09:19:20 127

原创 FUCK

2019-01-17 16:51:20 1900

原创 [Wc2010]重建计划

                                  [Wc2010]重建计划   Description Input 第一行包含一个正整数N,表示X国的城市个数. 第二行包含两个正整数L和U,表示政策要求的第一期重建方案中修建道路数的上下限 接下来的N-1行描述重建小组的原有方案,每行三个正整数AiBiVi分别表示道路(AiBi)其价值为Vi 其中城市由1..N进行标号...

2019-01-14 20:22:34 247

原创 [poj1813]熄灯问题

[poj1813]熄灯问题 Description 有一个由按钮组成的矩阵,其中每行有6个按钮,共5行。每个按钮的位置上有一盏灯。当按下一个按钮后,该按钮以及周围位置(上边、下边、左边、右边)的灯都会改变一次。即,如果灯原来是点亮的,就会被熄灭;如果灯原来是熄灭的,则会被点亮。在矩阵角上的按钮改变3盏灯的状...

2019-01-14 19:04:53 261

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除