自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

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

原创 1556: 墓地秘密 (最短路+状压dp)

#include#include#include#define p(x,y) (x-1)*4+y+1using namespace std;inline int read(){ int x=0,f=1;char ch=getchar(); while(ch'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*

2014-11-15 14:48:22 871

原创 1806: [Ioi2007]Miners 矿工配餐 (dp+滚动数组)

#include#include#includeusing namespace std;char ch[100010];int n,ans,f[5][4][4][4][4];int g(char c){ if(c=='M')return 1; if(c=='F')return 2; return 3;}int c(int x,int y,int z){ int r=1;

2014-11-14 22:44:16 600

原创 2599: [IOI2011]Race (点分治)

#include#include#define inf 1000000000using namespace std;inline int read(){ int x=0,f=1;char ch=getchar(); while(ch'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+c

2014-11-14 20:37:00 663

原创 2734: [HNOI2012]集合选数 (状压dp)

#include#include#include#define mod 1000000001using namespace std;int read(){ int x=0,f=1;char ch=getchar(); while(ch'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';c

2014-11-14 14:58:13 517

原创 1086: [SCOI2005]王室联邦 (dfs+贪心)

#include#includeusing namespace std;int read(){ int x=0,f=1;char ch=getchar(); while(ch'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f;}str

2014-11-14 13:23:39 959

原创 1193: [HNOI2006]马步距离 (贪心+搜索)

#include#include#include#include#includeusing namespace std;const int dx[8]={-2,-1,1,2,2,1,-1,-2},dy[8]={1,2,2,1,-1,-2,-2,-1};int sx,sy,ex,ey,dex,dey,s[200][200],ans=0;struct data{ int x,y;}

2014-11-14 11:14:48 604

原创 3631: [JLOI2014]松鼠的新家 (树形DP,树链剖分套线段树)

#include#includeusing namespace std;inline int read(){ int x=0,f=1;char ch=getchar(); while(ch'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f

2014-11-13 12:43:11 647

原创 3192: [JLOI2013]删除物品 (树状数组)

#include#include#includeusing namespace std;const int N=100005;int n,n1,n2,now,t[N];pair a[N];long long ans;inline int read(){ int x=0,f=1;char ch=getchar(); while(ch'9'){if(ch=='-')f=-1;ch=

2014-11-11 21:13:58 336

原创 2768: [JLOI2010]冠军调查 (最大流)

#include#include#include#define inf 0x7fffffffusing namespace std;struct data{ int to,next,v;}e[100001];int n,m,ans,cnt=1,head[305],h[305],q[305];void insert(int u,int v,int w){ e[++cn

2014-11-11 15:37:08 696

原创 2789: [Poi2012]Letters (树状数组求逆序对数)

#include#include#includeusing namespace std;char a[1000010],b[1000010];queue q[30];int n,v[1000010],t[1000010];long long ans;int query(int x){ int res=0; for(int i=x;i;i-=i&(-i)) res+=t[i]

2014-11-11 15:29:00 1044

原创 1098: [POI2007]办公楼biu (bfs+链表)

#include#include#include#include#include#include#includeusing namespace std;inline int read(){ int x=0,f=1;char ch=getchar(); while(ch'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<=

2014-11-11 15:00:44 436

原创 2783: [JLOI2012]树 (dfs+平衡树)

#include#include#includeusing namespace std;inline int read(){ int x=0,f=1;char ch=getchar(); while(ch'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} r

2014-11-11 10:40:11 370

原创 1146: [CTSC2008]网络管理Network (线段树套平衡树+二分+树链剖分)

O(nlogn^4)#include#include#includeusing namespace std;inline int read(){ int x=0,f=1;char ch=getchar(); while(ch'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc

2014-11-11 10:00:28 532

原创 1680: [Usaco2005 Mar]Yogurt factory (贪心)

#include#includeusing namespace std;int n,s,la;long long ans;int main(){ scanf("%d%d",&n,&s); for(int i=1;i<=n;i++){ int k,a;scanf("%d%d",&k,&a); if(la)k=min(k,la+s); ans+=k*a; la=k; }

2014-11-10 23:08:15 992

原创 3721: PA2014 Final Bazarek (贪心)

#include#include#includeusing namespace std;const int N=1000010,inf=1000000000;int n,m,v[N],mx1[N],mx2[N],mn1[N],mn2[N];long long sum[N];int main(){ mn1[0]=mn2[0]=inf; scanf("%d",&n); for(in

2014-11-10 23:07:44 302

原创 2818: Gcd (欧拉函数)

#include#includeusing namespace std;const int N=10000011;int n,tot,pri[N],phi[N];long long ans,f[N];bool mark[N];void getphi(){ phi[1]=1; for(int i=2;i<=n;i++){ if(!mark[i])pri[++tot]=i,phi

2014-11-10 13:02:13 545

原创 Vijos P1780 开车旅行 (倍增+Treap)

#include#include#include#include#include#include#define inf 1000000001using namespace std;int n,m,NOW,a[200010],x0,Si[100001],Xi[100001],sz,rt,tmp,tmp2,da[200010][18],db[200010][18],to[200010]

2014-11-06 11:40:16 534

原创 Vijos P1757 逆序对 (动态规划)

#include #include #include using namespace std;int T,n,k,f[1010][1010];int main() { scanf("%d",&T); for(int i=1; i<=1000; i++)f[i][0]=1; for(int i=2; i<=1000; i++) for(int j=1

2014-11-05 20:47:47 492

原创 3436: 小K的农场 (差分约束)

#include#include#includeusing namespace std;int read() { int x=0,f=1; char ch=getchar(); while(ch'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9')

2014-11-02 12:10:42 245

原创 3431: [Usaco2014 Jan]Bessie Slows Down (模拟)

#include#include#includeusing namespace std;int read() { int x=0,f=1; char ch=getchar(); while(ch'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9')

2014-11-02 11:39:36 2084

原创 3404: [Usaco2009 Open]Cow Digit Game又见数字游戏 (博弈论)

#include#include#include#includeusing namespace std;int read() { int x=0,f=1; char ch=getchar(); while(ch'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&

2014-11-02 11:05:04 394

原创 3402: [Usaco2009 Open]Hide and Seek 捉迷藏 (dijkstra+heap)

#include#include#include#includeusing namespace std;int read() { int x=0,f=1; char ch=getchar(); while(ch'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&

2014-11-02 10:45:43 286

原创 1715: [Usaco2006 Dec]Wormholes 虫洞 (SPFA判负环)

#include#include#include#includeusing namespace std;int read() { int x=0,f=1; char ch=getchar(); while(ch'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&

2014-11-02 09:48:11 226

原创 2763: [JLOI2011]飞行路线 (分层图最短路+SLF优化)

SLF优化+分层图。SLF优化:ru

2014-11-02 09:32:10 205

原创 2711: [Violet 2]After 17 (动态规划+点积)

sigma(xi*xj+yi*yj)=[(x1+x2+...+xn)^2-(x1^2+x2^2+...xn^2)+(y1+y2+...+yn)^2-(y1^2+y2^2+...+yn^2)]/2#include#include#include#define ll long longusing namespace std;int n,X[201],Y[201];bool f[2][800

2014-11-01 23:02:09 320

原创 Vijos P1002 过河 (动态规划)

#include#include#include#includeusing namespace std;int f[20],a[200],n,s,t,m,p=1,ans=1000000000,now,tot;int main() { scanf("%d%d%d%d",&n,&s,&t,&m); for(int i=1; i<=m; i++) scanf(

2014-11-01 19:54:16 256

空空如也

空空如也

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

TA关注的人

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