唉,没想出来……注意到预处理的作用。还有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
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
标准的平衡树。贴个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
快速幂水过,贴一下模版。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
不得不说块状数组好神奇的啊!这道题的标签可是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
注意到数列只增不减,而题目中又明确说道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
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