上一页 1 ··· 74 75 76 77 78
唉,没想出来……注意到预处理的作用。还有CLJ大牛说的话:这么小的数据,想干什么都可以。SPFA预处理+DP 够经典var f:array[0..100,0..100]of longint; a:array[0..20,0..100]of boolean; head,next,go... Read More
posted @ 2014-06-01 11:42 ZYF-ZYF Views(215) Comments(0) Diggs(0) Edit
treap!var i,n,x,y,ans,a,b,root,tot,ft:longint; l,r,s,v,hr:array[0..100000] of longint;procedure r_rotate(var x:longint); var y:longint; begin y:=l[... Read More
posted @ 2014-06-01 10:40 ZYF-ZYF Views(252) Comments(0) Diggs(0) Edit
标准的平衡树。贴个splay吧var v,l,r,fa:array[0..100000] of longint; root,x,i,n,ans:longint;procedure zig(x:longint); var y,z:longint; begin y:=fa[x];z:=fa[y]; if... Read More
posted @ 2014-06-01 10:24 ZYF-ZYF Views(204) Comments(0) Diggs(0) Edit
快速幂水过,贴一下模版。const mo=100003;var x,y,n,m:int64;function power(num,times:int64):int64; var temp:int64; begin if times=1 then exit(num); temp:=power(num,... Read More
posted @ 2014-06-01 10:18 ZYF-ZYF Views(168) Comments(0) Diggs(0) Edit
不得不说块状数组好神奇的啊!这道题的标签可是splay的启发是合并(什么高大上的东西),竟然这么轻松的就解决了!var x,y,i,j,tot,n,m,ch:longint; f,k,l,bl,go:array[0..200100] of longint;procedure init; beg... Read More
posted @ 2014-06-01 09:51 ZYF-ZYF Views(160) Comments(0) Diggs(0) Edit
注意到数列只增不减,而题目中又明确说道my then exit(x) else exit(y); end;procedure build(x,y,k:longint); var mid:longint; begin with t[k] do begin l:=x;r:=y; if ... Read More
posted @ 2014-06-01 09:46 ZYF-ZYF Views(203) Comments(0) Diggs(0) Edit
type node1=record go,next:longint;end; node2=record l,r,mx,sum:longint;end;var i,x,y,n,q,tmp,cnt,sz,code:longint; ch,st:string; fa:a... Read More
posted @ 2014-06-01 00:04 ZYF-ZYF Views(200) Comments(1) Diggs(0) Edit
用E[i,j]表示共有i个数字,以1..j开头且一开始下降的方案数的总和。则我们有:E[i,j]:=E[I,J-1]+E[i-1,i-j]我们先来证明上升与下降的方案是一一对应的。事实上,若有a1,a2,a3,……,an 为满足要求的一个序列(上升或下降),则我们构造新数列,n+1-a1,n+1-a... Read More
posted @ 2014-05-31 11:35 ZYF-ZYF Views(911) Comments(0) Diggs(0) Edit
上一页 1 ··· 74 75 76 77 78