自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Dijkstra

RTclass woca{public: int x; int y;};//x下一个节点,y为权值vector adj[10010];int n,m,u,v,s;long long cost[10010],FZ[10010];int dist[10010];bool CP[10010];bool operator<(woca n,woca m){ if(n.y<

2015-08-27 14:42:26 361

原创 质因数分解以及乘法逆元

RTinline void EXGCD(LL a,LL b){ if(b==0) { X=1;Y=0; } else { EXGCD(b,a%b); LL p=X; X=Y; Y=p-(a/b)*Y; }}inline LL inve(LL num){ EXGCD(num,MOD); return X;}inline void Get_Factor

2015-08-27 14:17:19 340

原创 有向图Tarjan

RTinline void Tarjan(int x){ dfn[x]=low[x]=++index; flag[x]=1;push(x); for(int i=0;i<map[x].size();i++) { int next=map[x][i]; if(dfn[next]==-1) { Tarjan(next); low[x]=min(low[x],low

2015-08-26 20:31:01 359

原创 字典树

插入字典树:class woca{public: int son,brother; char p;}a[100000];string A;void build_tree(string A){ int l=A.length(); int now=1; for(int i=0;i<l;i++) { if(a[now].son==0) { a[++sum].p=

2015-08-26 19:57:20 303

原创 二分图最大匹配

匈牙利算法:int match[140];bool flag[140];int map[140][140];int dfs(int p){ int i; for(i=1;i<=N;i++) { if(map[p][i]==1&&flag[i]==0) { flag[i]=1; if(match[i]==-1||dfs(match[i])) { m

2015-08-26 19:44:50 297

原创 Dinic

网络流:bool bfs()//建层次图 { int i,temp;deque Q; Q.push_back(0);memset(dist,-1,sizeof(dist)); dist[0]=0; while(!Q.empty()) { temp=Q.at(0);Q.pop_front(); for(i=0;i<=N+1;i++) { if(map[temp][i

2015-08-26 19:43:05 363

原创 快速幂和快速乘法

RTll Quick_Pow(ll a,ll n) { ll ret=1; ll temp=a%p; while (n){ if (n&1) ret=ret*temp%p; temp=temp*temp%p; n>>=1; } return ret;}ll Quick_Mul(ll x,ll m)

2015-08-26 19:42:12 378

原创 线性筛

线性筛法#define M 100000 LL prime[M/3];bool flag[M];inline void get_prime(){ LL i,j; memset(flag,false,sizeof(flag)); for(i=2;i<M;i++){ if(!flag[i])

2015-08-26 19:35:27 442

原创 树链剖分

做了两个题找了找感觉。分别是 SPOJ375 和 codeforces191c,都是用线段树维护的。其实第二题不用线段树也可以。。关键是理解树链剖分的过程,然后找合适的数据结构去维护它。SPOJ375:等下。。。codeforces191c:#include#include#include#includeusing namespace std;struct Nod

2015-08-10 16:05:37 374

原创 手写邻接表

int head[400005],t;inline void init(){ memset(head,0,sizeof(head)); t=1;}inline void add(int u,int v,int w){ map[t].u=u; map[t].v=v; map[t].w=w; map[t].next=head[u]; head[u]=t;t++;}

2015-08-10 16:04:22 412

原创 Test

#includeusing namespace std;int main(){ printf("hello,world\n"); return 0;}

2015-08-02 10:14:28 317

空空如也

空空如也

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

TA关注的人

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