自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Free Loop~~~跳动的音符

开荒~刷题~重新起航~追寻梦想~永不放弃~~~

  • 博客(162)
  • 收藏
  • 关注

原创 Python 程序设计快速入门简易教程

Python 程序设计快速入门简易教程Python语言快速检索一些需要知道的事一个简单的Python程序Python的基本数据类型Python的基本运算符Python的常用函数// import 库的用法分支语句循环结构字符串列表的使用元组自定义函数使用库编程Thanks for reading...Python语言快速检索Python的语法简洁,实用,假设你已有C++程序设计基础,接下来跟着我走,瞬间学会Python语言,对于信息学竞赛的学生可以用Python出随机数据是非常方便的,如果感兴趣,还可以

2020-06-03 17:20:56 1197

原创 Linux compare shell

for i in $(seq 1 100000);do ./gen ./sol ./bf if diff tmp.out tmpb.out ;then echo $i "AC ~ HAHAHA ~" else echo $i "WA ~ WA ~" exit 0 fidone

2016-11-17 22:00:08 1755 4

原创 Ubuntu里VIM的基本配置运行

sudo gedit /etc/vim/vimrc 打开配置文件,在最后面输入如下文字,保存:set nu    //显示行号set tabstop=4    //设置TAB为4格set autoindent    //设置自动缩进set cursorline     //凸出显示该行set cursorcolumn    //凸出显示该列color blue

2016-11-10 15:59:28 3508

原创 信息学竞赛中的各种低级错误,持续更新中~~~,各位同学来跟帖!!

1、写错文件名,包括程序文件名,输入输出wen2、

2014-11-11 17:51:21 5718 33

原创 HDU1285拓扑排序模板题

#include<bits/stdc++.h>using namespace std;const int maxn=510;int rd[maxn],ans[maxn];vector<int> a[maxn];priority_queue<int ,vector<int>,greater<int> > q;int main(){ int n,m; while(cin>>n>>m){ for(int i=1

2022-05-02 16:27:29 404

原创 POJ2418字典树

#include<iostream>#include<cstdio>#include<cstring>using namespace std;const int maxn=1000010;struct node{int p,ch[130];}a[maxn];int cnt=1,sum=0;char t[35];void out(int rt,int L){ for(int i=0;i<=129;i++){ int u=a[rt].ch[i];

2022-04-12 21:14:47 429

原创 字典树POJ2001

#include<iostream>#include<cstdio>#include<cstring>using namespace std;const int maxn=100010;struct node{ int p,ch[30],count; }a[maxn];int cnt,n;char tmp[maxn][30];int main(){ cnt=1; n=0; while(gets(tmp[++n])){ if(!tmp[n][0]

2022-04-10 21:39:08 397

原创 字典树poj2503

#include<iostream>#include<cstdio>#include<cstring>using namespace std;const int maxn=1000010;struct node{ int p,ch[30]; char t[15];}a[maxn];int cnt,n,T;char s1[15],s2[15],tmp[30];int main(){ cnt=1; while(gets(tmp)){ if(!t

2022-04-10 19:55:29 543

原创 POJ3630 字典树

#include<iostream>#include<cstdio>#include<cstring>using namespace std;const int maxn=100010;struct node{int p,ch[30];}a[maxn];int cnt,n,T;int main(){ char x[25]; cin>>T; while(T--){ cnt=0; memset(a,0,sizeof(a)); int f

2022-04-10 16:02:38 376

原创 SPLAY的各种操作

#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>using namespace std;const int maxn=100010;struct node{ int v,s,fz,f,ch[2]; //ch[0]:left;ch[1]:right;}a[maxn];int root=1,t[maxn];void push_up(int rt){ int

2022-04-05 21:52:52 473

原创 splay poj1442

#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>using namespace std;const int maxn=100010;struct node{ int v,s,f,ch[2]; //ch[0]:left;ch[1]:right;}a[maxn];int root=1,t[maxn];void push_up(int rt){ int l=

2022-04-05 19:55:59 89

原创 SPLAY 排序模板

#include<bits/stdc++.h>using namespace std;const int maxn=100010;struct node{ int v,s,f,ch[2]; //ch[0]:left;ch[1]:right;}a[maxn];int root=1;void out(int rt){ if(rt){out(a[rt].ch[0]); printf("%d ",a[rt].v); out(a[rt].ch[1]);}}void rotate(i

2022-04-03 20:50:16 379

原创 POJ1442 TREAP名次树

#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>using namespace std;const int maxn=30010;struct node{ int v,w,s; node *fa,*l,*r; node(){s=1;w=rand();fa=l=r=NULL;}};node *root;int a[maxn];int js(node

2022-03-29 19:58:42 272

原创 TREAP 参考程序

//动态#include<bits/stdc++.h>using namespace std;struct node{ int v,w; node *fa,*l,*r; node(){w=rand();fa=l=r=NULL;}};node *root;void yx(node *B,node *A){ node *f=A->fa,*y=B->r; B->r=A; A->fa=B; A->l=y; if(y!=NULL)y->fa=

2022-03-27 20:01:29 424

原创 ural 1553 树剖+线段树

#include<bits/stdc++.h>using namespace std;#define Mid ((l+r)>>1) #define lson rt<<1,l,Mid #define rson rt<<1|1,Mid+1,r const int maxn=100000+10;int to[maxn*2],nex[maxn*2],beg[maxn];int fa[maxn],dis[maxn],siz[maxn],son[ma

2022-03-22 19:35:05 389 1

原创 POJ 2763树剖+线段树+树状数组

代码分享

2022-03-20 20:00:07 296 1

转载 树上差分(LUOGU3128)

#include<bits/stdc++.h>using namespace std;typedef long long ll;const int inf = 0x3f3f3f3f;const int mod = 1e8;const int Max = 5e4 + 10;const int Max2 = 5e3 + 10;struct Edge{ int to, next;}edge[Max<<1]; int n, k;int head[Max], tot;

2021-05-25 19:46:59 141

原创 旋转卡壳,最远的距离

#include <cmath> #include <algorithm> #include <iostream> using namespace std; #define MAXN 50005 struct Point{ int x, y; bool operator < (const Point& _P) const{ return y<_P.y||(y==_P.y&&x<_P.

2021-03-09 21:19:05 175

原创 二维凸包 模板代码

#include<iostream>#include<cstdio>#include<cmath>#include<algorithm>const int maxn=10000+10;using namespace std;struct node{double x,y;};node p[maxn],z[maxn];bool cmp(node u,node v){return u.x<v.x;}bool cmpxl(node a,node

2021-03-02 20:35:22 170

原创 最小费用最大流模板

#define REP(i, s, e) for(register int i = s; i <= e ;i++)#include<bits/stdc++.h>using namespace std;const int maxn = 5000 + 5, maxm = 50000 + 5, inf((((1 << 30) - 1) << 1) + 1);int bg[maxn], ne[maxm << 1], to[maxm << 1]

2021-02-25 21:09:23 145

原创 网络流模板程序

网络流模板程序EK#include<bits/stdc++.h>using namespace std;const int maxn = 210;const long long INF =1152921504606846976;long long cap[maxn][maxn], flow[maxn][maxn];long long n,m,p[maxn];long long a[maxn];;int main(){ int s,t; cin>>n>&gt

2021-02-21 20:44:47 148

转载 求树的直径

树的直径,即树上的最长路径,显然,树的直径可以有很多条(考虑一棵菊花)。接下来我们考虑如何求出一棵树的直径。有很多种O(n)的算法。算法1:我们任取树中的一个节点x,找出距离它最远的点y,那么点y就是这棵树中一条直径的一个端点。我们再从y出发,找出距离y最远的点就找到了一条直径。这个算法依赖于一个性质:对于树中的任一个点,距离它最远的点一定是树上一条直径的一个端点。下面给出证明。考虑这样...

2018-12-29 14:49:22 1176

原创 POJ1655 树的重心

#include&amp;amp;lt;iostream&amp;amp;gt;#include&amp;amp;lt;cstdio&amp;amp;gt;#include&amp;amp;lt;vector&amp;amp;gt;using namespace std;const int maxn=50000+5,inf=100000000;int sum[maxn];vector &amp;amp;lt;int&am

2018-12-29 14:31:11 272

原创 数据结构之栈的使用

数据结构之栈的使用数制转换括号匹配检验后缀表达式表达式求值 &amp;amp; 中缀表达式转后缀表达式递归 &amp;amp; 深度优先搜索由于栈结构具有后进先出的固有特性,致使栈称为程序设计中的有用工具。数制转换括号匹配检验后缀表达式表达式求值 &amp;amp; 中缀表达式转后缀表达式递归 &amp;amp; 深度优先搜索...

2018-12-16 18:32:34 339 2

原创 C++STL系列 队列的使用

/*queue的成员函数 empty 测试容器是否为空,为空时返回true size 返回容器的大小 front 返回队列的第一个元素,即最早被压进队列的元素//队首 back 返回队列的最后一个元素,即最晚被压进队列的元素//队尾 push 把元素添加至队列尾 pop 弹出队列首元素*/#includeusing namespace std

2017-09-26 09:30:44 3059

原创 C++STL系列 结构体运算符重载及优先队列的使用

#includeusing namespace std;struct node{ int x,y; bool operator <(const node b)const{ return this->x>b.x; }};priority_queue q;int main(){ int i,j,k,m,n; cin>>n; for(i=1;i<=n;i++){ node

2017-09-26 09:03:06 1279

原创 POJ 1463 TREE DP

#include#include#includeconst int maxn=6000+10;using namespace std;int to[maxn],beg[maxn],nex[maxn],e;int fa[maxn],f[maxn][2],p[maxn];void dfs(int x){ p[x]=1; for(int i=beg[x];i;i=nex[i]){

2017-09-03 21:47:19 462

原创 POJ 2342 Anniversary party ~~Tree Dp

/*【题意】公司有n个人,每个人有价值vi,有一天举办年会,每个人都可以参加,但有严格的等级制度,参加活动时,不能同时出现a和a的上司,问如何才能使总和最大。【分析】每个人只有去和不去两种状态,设f[i][0]和f[i][1]分别表示第i个人不参加和参加年会,获得的总的最大价值。则状态转移方程为:f[i][1] += f[j][0],f[i][0] += max{f[j][0],f[

2017-09-03 09:54:24 434

原创 USACO1.1 贪婪的送礼者+MAP+VECTOR使用

#include#include#include#include#include#include#include#includeconst int maxn=1000000+10;using namespace std;vectors;mapsen,rec;int main(){ int i,j,k,m,n; cin>>n; for(i=1;i<=n;i++){

2017-08-15 10:49:57 607

原创 spfa+vector

#include#include#include#include#include#include#includeconst int maxn=10000+10,inf=1000000000;using namespace std;struct node{int to,z;};int p[maxn],d[maxn];vectore[maxn];int q[maxn*100];

2017-08-15 10:02:52 725

原创 USACO FC,二维凸包

#include#include#include#includeconst int maxn=10000+10;using namespace std;struct node{double x,y;};node p[maxn],z[maxn];bool cmp(node u,node v){return u.x<v.x;}bool cmpxl(node a,node b,node

2017-08-14 11:28:50 346

原创 USACO RECT1 离散化处理

#include#include#includeconst int maxn=2002,maxm=10000+1;using namespace std;struct node{int x1,y1,x2,y2,c;}s[1001];short int a[maxn][maxn];int sjx[maxm],sjy[maxm],xnx[maxn],xny[maxn],cs[1000+5

2017-08-14 11:28:08 400

原创 矩阵快速幂

#include#include#includeconst int maxn=100+10;#define ll long longconst int b=1000000000+7;using namespace std;ll a[maxn][maxn],s[maxn][maxn],tmp[maxn][maxn];int main(){ int n;ll k; c

2017-08-05 15:47:25 445

原创 HDU1166树状数组

#include#include#include const int maxn=50000+10;using namespace std;int c[maxn],n;int lowbit(int x){return x & -x;}void add(int x,int y){ while(x<=n){ c[x]+=y; x+=lowbit(x); }}int cal(

2017-08-04 11:26:28 461

转载 hihoCoder1183 tarjan算法应用之割边和割点

#include#include#includeusing namespace std;int n,m,order=0;int low[20004],dfn[20004],father[20004],son[20004];//father:父结点 son:子结点个数 vector cutpoint,edge[20004];vector > cutedge;void tarjan

2017-07-10 12:41:50 403

原创 POJ2186 Popular Cows Kosaraju

题目大意是:在一个牧群中,有N个奶牛,给定M对关系(A,B)表示A仰慕B,而且仰慕关系有传递性,问被所有奶牛(除了自己)仰慕的奶牛个数因为仰慕关系具有传递性,因此在一个强连通分量中,每个奶牛都被分量中的其他奶牛膜拜,而且也膜拜着分量中的其他奶牛,这种互相膜拜的场景在现实生活中也是经常存在的,因此,本题可以将强连通分量缩点,并构造新图,最后做一次扫描,统计出度为0的点的个数,如果正好为1

2017-07-10 03:19:51 557

原创 单元最短路模板 dijistra

#include#include#include#includeconst int maxn=10000+10,inf=1000000000;using namespace std;struct node{int to,w;};int d[maxn],p[maxn];vector e[maxn];void add(int x,int y,int z){ node t; t.t

2017-07-10 02:23:27 600

原创 POJ-3660-Cow Contest FLOYD传递闭包

题目大意是说:给出牛之间的强弱关系,让你确定有多少头牛能够确定其排名。用Floyd做,对每给的一个胜负关系连一条边,最后跑一次Floyd,然后判断一头牛所确定的关系是否是n-1次,若是,则这头牛的排名可以确定#include#include#includeconst int maxn=100+10;using namespace std;int d[maxn][maxn],n,m

2017-07-10 01:23:06 346

原创 本人2011级学生TXH大佬写的超短的SAP网络流程序

/*ID:t-x.h1PROB:ditchLANG:C++*/#include#define min(a,b) ((a)<(b)?(a):(b))const int MAX=2100000000,MAXn=200+9;int n,answer,g[MAXn][MAXn],d[MAXn],gap[MAXn],st=1,ed=n;int sap(int u,int flow){

2017-06-27 21:41:02 639

原创 HDU1075静态数组实现字典树

#include#include#includeconst int maxn=1000000+10;using namespace std;struct node{ int count,next[30]; string word;}a[maxn];int e,flag;string sx;void insert(string hx,string yy){ int len=h

2017-06-23 14:19:07 535

空空如也

空空如也

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

TA关注的人

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