- 博客(11)
- 资源 (5)
- 收藏
- 关注
原创 noip 乌龟棋
滚动数组 //图论?因为只有四种颜色,因此,一个点连四条边 //数据保证到达终点时刚好用光 MM 张爬行卡片。??这就比较麻烦了 //回忆之前做过的搜索题 //f[i][j],j表示已经用了几张牌了 //表示每张牌还有几张f[][p][q][u][v] //begin #include<iostream> #include<cstdio> #include<cstr...
2018-07-27 18:49:32 158
原创 树剖
#include&lt;iostream&gt; #include&lt;cstdio&gt; #define MAXN 1e7+5 using namespace std; int hd[MAXN]; struct node{ int frm,to,nxt; }edge[MAXN]; int cnt=0; void add(int u,int v) { cnt++; e...
2018-07-25 18:48:09 631
原创 gss4
#include<bits/stdc++.h> #define N 100005 #define ll long long using namespace std; int n; ll a[N]; struct Tree{ int l,r; ll sm; int flg; }tre[N<<2]; void pushup(int rt) { t...
2018-07-19 20:06:51 212
原创 gss3
#include&lt;bits/stdc++.h&gt; #define LL long long #define INF 0x3f3f3f3f using namespace std; int n,m,a[500005]; struct Tree{ LL l,r,ls,rs,mx,sum; }tre[500005&lt;&lt;2]; void build(int rt,int L,i...
2018-07-18 21:49:08 407
原创 SP1043 GSS1 - Can you answer these queries I
#include<bits/stdc++.h> #define LL long long #define INF 0x3f3f3f3f using namespace std; int n,m,a[500005]; struct Tree{ LL l,r,ls,rs,mx,sum; }tre[500005<<2]; void build(int rt,int L,i...
2018-07-18 21:23:45 218
原创 bzoj3211 花神游历各国
单点修改,区间查询,优化方法:sqrt到一定程度,数为0,向上传标记,下次再修改时,如果有标记,则不修改,提高修改的时间。区间查询和普通的一样。 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #defin...
2018-07-16 22:32:13 156
原创 P3128 [USACO15DEC]最大流Max Flow [树上差分-点差]
两点间的路径每个点给一个单位的压力,询问最大压力的点。 LCA用的离线,点在树上差分 #include<bits/stdc++.h> #define mxn 500005 using namespace std; int n,k,x,y,hd[mxn],fa[mxn],cnt,vis[mxn],dfn[mxn],cf[mxn],du[mxn],s,nod[mxn],bis[mxn]...
2018-07-12 10:43:50 238
原创 P1607 [USACO09FEB]庙会班车Fair Shuttle庙会 [线段树+贪心]
贪心:按照每组奶牛终点排序,贪心策略,能早下的先下 区间加法,区间查询 #include&lt;bits/stdc++.h&gt; using namespace std; int n,k,C; struct Pep{ int s,t,c; }p[50005]; struct Tree{ int l,r,mx,num; }tre[20005&lt;&lt;2];// bool ...
2018-07-11 20:38:29 267
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人