自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

EM LGH

It's Time to Make History

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

原创 洛谷 P2486 [SDOI2011]染色 LCT

Code:#include <cstdio> //SDOI2010 染色#include <algorithm>#include <cstring>#include <string>using namespace std;void setIO(string a){ freopen((a+".in"...

2018-11-29 19:30:00 177

原创 洛谷 P1501 [国家集训队]Tree II Link-Cut-Tree

Code:#include <cstdio>#include <algorithm>#include <cstring>#include <string>using namespace std;void setIO(string a){ freopen((a+".in").c_str(),"r",stdin); ...

2018-11-27 18:07:00 94

原创 洛谷P3803 【模板】多项式乘法(FFT)

代码太丑,就不贴了,有时间的话写一下讲解....#include <cmath>#include <cctype>#include <cstdio>#include <cstring>#include <string>#include <algorithm>using namespace std;...

2018-11-25 10:05:00 131

原创 BZOJ 3786: 星系探索 欧拉游览树

一个叫 Euler-Tour-Tree 的数据结构,说白了就是用 Splay_Tree 维护欧拉序#include <cstring>#include <algorithm>#include <string>#include <cstdio>using namespace std;void setIO(string a){...

2018-11-24 11:31:00 231

原创 洛谷P3690 【模板】Link Cut Tree (动态树)

Code:#include<cstdio>#include<algorithm>#include<string>#include<cstring>using namespace std;void setIO(string a){ freopen((a+".in").c_str(),"r",stdin);}struct LCT...

2018-11-22 18:41:00 138 1

原创 noip 2018 day1 T2 货币系统 完全背包

Code:#include<cstdio>#include<string>#include<cstring>#include<algorithm>using namespace std;int arr[1000],f[100000],A[100000],bomb[100000];void setIO(string a){ ...

2018-11-17 11:00:00 161

原创 noip 2018 货币系统 完全背包

题目链接如果一个数能被比它小的数表示出来,那么这个数就不用选跑一遍完全背包即可#include<cstdio>#include<string>#include<cstring>#include<algorithm>using namespace std;int arr[1000],f[100000],...

2018-11-17 11:00:00 63

原创 noip 2018 day1 T3 赛道修建 贪心_树上问题_multiset

Code:// luogu-judger-enable-o2#include&lt;bits/stdc++.h&gt;using namespace std;#define maxn 50008#define MAXR 500000001#define ll int multiset &lt;ll&gt; S[maxn];multiset &lt;ll&gt; ::...

2018-11-17 10:58:00 179 1

原创 noip 2018 day1 T3 赛道修建 贪心 + 树上问题 + multiset

Code:// luogu-judger-enable-o2#include<bits/stdc++.h>using namespace std;#define maxn 50008#define MAXR 500000001#define ll int multiset <ll> S[maxn];multiset &l...

2018-11-17 10:58:00 115

原创 noip 2018 day2 T1 旅行 基环树 tarjan

Code:#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;string&gt;#include&lt;stack&gt;#include&lt;algorithm&gt;#include&lt;vector&gt;using namespace std;void setIO(string a){ ...

2018-11-17 10:55:00 181

原创 noip 2018 day1 T1 铺设道路 贪心

Code:#include&lt;cstdio&gt;using namespace std;int main(){ int last=0,ans=0; int n;scanf("%d",&amp;n); for(int i=1;i&lt;=n;++i) { int t;scanf("%d",&amp;t); if(t&gt;last)ans+=t-last...

2018-11-17 10:52:00 151

原创 [USACO07JAN]平衡的阵容Balanced Lineup RMQ模板题

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;using namespace std;const int maxn = 50000 + 12;int A[maxn];int dmax[maxn][40];int dmin[maxn][40];void init(int *A, int n){ for (int ...

2018-11-09 19:37:00 117

原创 假期的宿舍 二分图

Code:#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;vector&gt;#include&lt;queue&gt;#include&lt;algorithm&gt;using namespace std;const int maxn=300;const int INF=1000000+233;in...

2018-11-09 13:17:00 129

原创 SP1026 FAVDICE - Favorite Dice 数学期望

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;using namespace std;#define maxn 1009double dp[maxn];int main(){ int n,t; scanf("%d",&amp;t); while(...

2018-11-08 18:32:00 96

原创 [Usaco2009 Feb]Stock Market 股票市场 完全背包

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;iostream&gt;#include&lt;cstring&gt;#include&lt;stack&gt;#include&lt;string&gt;using namespace std;void setIO(string a){ fr...

2018-11-08 14:43:00 189

原创 [COI2007] Patrik 音乐会的等待 单调栈

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;iostream&gt;#include&lt;cstring&gt;#include&lt;stack&gt;#include&lt;string&gt;using namespace std;void setIO(string a){ fr...

2018-11-08 14:40:00 208

原创 [NOI2012]随机数生成器 矩阵乘法

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;iostream&gt;#include&lt;cstring&gt;#include&lt;string&gt;using namespace std;void setIO(string a){ freopen((a+".in").c_str(...

2018-11-08 14:38:00 191

原创 Noip2015 运输计划 树上差分 二分答案

Code:#include&lt;cstring&gt;#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;string&gt;using namespace std;void setIO(string a){freopen((a+".in").c_str(),"r",stdin);}#define max...

2018-11-07 23:23:00 124

原创 bzoj 2259: [Oibh]新型计算机 最短路 建模

Code:#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;algorithm&gt;#include&lt;queue&gt;using namespace std;#define maxn 3000005int head[maxn], to[maxn], nex[maxn], val[maxn],edge...

2018-11-07 15:04:00 157

原创 888E - Maximum Subsequence 中途相遇法

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;#include&lt;string&gt;using namespace std;void setIO(string a){freopen((a+".in").c_str(),"r",stdin),freopen((a+"

2018-11-07 13:55:00 165

原创 [ZJOI2012]旅游 对偶图 树的直径

Code:// luogu-judger-enable-o2#include&lt;cstdio&gt;#include&lt;iostream&gt;#include&lt;algorithm&gt;#include&lt;map&gt;#include&lt;vector&gt;#include&lt;string&gt;#include&lt;cmath&gt;

2018-11-07 13:54:00 86

原创 [HAOI2007]理想的正方形 单调队列 暴力

Code:#include&lt;cstdio&gt;#include&lt;queue&gt;#include&lt;algorithm&gt;using namespace std;#define maxn 1002#define ll long long#define inf 100000000000int minv[maxn][maxn], maxv[maxn]...

2018-11-06 23:50:00 133

原创 bzoj1457: 棋盘游戏 SG函数 Nim

Code:#include&lt;cstdio&gt;#include&lt;cstring&gt;using namespace std;#define maxn 1003#define r 99int n, x[maxn],y[maxn],SG[102][102],tag[6000000];bool check(int xi,int yi){ if(xi==0...

2018-11-06 22:34:00 266

原创 Bomb HDU - 3555 数位dp

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;#include&lt;string&gt;#include&lt;iostream&gt;using namespace std;#define ll long long#define N 20 ll f[N][4],...

2018-11-06 19:54:00 108

原创 [JSOI2007]建筑抢修 优先队列 贪心

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;#include&lt;queue&gt;using namespace std;#define maxn 200000+4#define ll long longstruct WORK{ int cost,ed ; }...

2018-11-06 18:15:00 144

原创 S-Nim POJ - 2960 Nim + SG函数

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;string&gt;#include&lt;cstring&gt;using namespace std;#define maxn 10003int step[maxn],SG[maxn],m,ans,l,a,k;bool vis[maxn];...

2018-11-06 16:20:00 150

原创 bzoj 2287: 【POJ Challenge】消失之物 动态规划

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;queue&gt;#include&lt;cstring&gt;#include&lt;vector&gt;#include&lt;string&gt;using namespace std;void setIO(string a){ freo...

2018-11-06 14:39:00 95

原创 bzoj 2287: 【POJ Challenge】消失之物 动态规划 + 容斥

Descriptionftiasch 有 N 个物品, 体积分别是 W1, W2, ..., WN。 由于她的疏忽, 第 i 个物品丢失了。 “要使用剩下的 N - 1 物品装满容积为 x 的背包,有几种方法呢?” -- 这是经典的问题了。她把答案记为 Count(i, x) ,想要得到所有1 <= i <= N, 1 <= x <= M的 Count...

2018-11-06 14:39:00 62

原创 bzoj3252: 攻略 优先队列 并查集 贪心

考场上自己yy出来的做法.....Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;queue&gt;#include&lt;vector&gt;#include&lt;string&gt;using namespace std;void setIO(string a){ freope...

2018-11-06 13:15:00 139

原创 [BeiJing2009 WinterCamp]取石子游戏 Nim SG 函数

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;using namespace std;#define maxn 1003int arr[13],step[13],SG[maxn];bool vis[maxn];int main(){ //freopen("in...

2018-11-06 01:38:00 100

原创 Playing With Stones UVALive - 5059 Nim SG函数 打表找规律

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;using namespace std;typedef long long ll;ll SG(ll i){ return i % 2 ==0 ? i / 2 : SG(i/2);}ll arr[100000];int main(){ //freopen...

2018-11-06 00:30:00 93

原创 Division Game UVA - 11859 Nim

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;using namespace std;#define maxn 10005int nums[maxn], prime[maxn], cnt, vis[maxn];int main(){ //freopen("input.in","r",stdin); ...

2018-11-06 00:10:00 137

原创 [BJWC2011]禁忌 AC 自动机 概率与期望

#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;#include&lt;string&gt;#include&lt;queue&gt;#include&lt;cstdlib&gt;#include&lt;iostream&gt;using namespace std;void s

2018-11-05 22:57:00 188

原创 [Jsoi2010]连通数 bitset + Floyd

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;string&gt;#include&lt;cstring&gt;#include&lt;bitset&gt;using namespace std;void setIO(string a){ freopen((a+".in").c_str()...

2018-11-05 20:29:00 101

原创 洛谷P2197 nim游戏模板

Code:#include&lt;iostream&gt;using namespace std;int main(){ int t; cin&gt;&gt;t; while(t--){ int ans=0,n; scanf("%d",&amp;n); for(int i=1;i&lt;=n;++i){ int a; scanf("%d",&amp;...

2018-11-05 18:33:00 110

原创 [HNOI2008]GT考试

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;string&gt;#include&lt;cstring&gt;#include&lt;queue&gt;#define ll long long using namespace std;void setIO(string a){ freop...

2018-11-05 16:27:00 135

原创 观光公交 贪心 思维

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;string&gt;using namespace std;void setIO(string a){ freopen((a+".in").c_str(),"r",stdin);}void shutIO(){ fclose(stdin);}#de...

2018-11-05 11:01:00 111

原创 DNA Sequence POJ - 2778 AC 自动机 矩阵乘法

定义重载运算的时候一定要将矩阵初始化,因为这个调了一上午......Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;#include&lt;queue&gt;#include&lt;string&gt;#define maxn 100000typedef long lo...

2018-11-04 09:57:00 128

原创 bzoj5085: 最大 暴力 二分

Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;#include&lt;iostream&gt;#include&lt;string&gt;using namespace std;void setIO(string a){ freopen((a+".in").c_str(...

2018-11-03 14:32:00 212

原创 [HEOI2012]旅行问题 AC 自动机

题意:求两个字符串的最长公共后缀,使得该后缀是某个字符串的前缀。 题解:直接利用 $fail$ 指针的定义即可。相当于求自动机上两点的 LCA,好像倍增可以,怕炸空间就老老实实写树剖吧。  Code:#include&lt;cstdio&gt;#include&lt;algorithm&gt;#include&lt;queue&gt;#include&lt;cs...

2018-11-03 13:45:00 317

空空如也

空空如也

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

TA关注的人

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