摘要:
AC自动机模板题。 被卡内存了 死活A不掉。。 AC自动机参考教程: http://www.cppblog.com/menjitianya/archive/2014/07/10/207604.html 阅读全文
摘要:
var s:ansistring; cas:longint; function minp(st,len:longint):longint; var p1,p2,k,tmp:longint; begin p1:=0; p2:=1; k:=0; while ((p1p2) then exit(p2+st) else exit(p1+st); end; begin re... 阅读全文
摘要:
T1:皇帝的烦恼二分之后DP判断。 1 var v,a,b:array[0..30008] of longint; 2 n,ans,i,l,r,mid:longint; 3 function max(a,b:longint):longint; 4 begin 5 if a>b the... 阅读全文
摘要:
const maxn=50008; INF=2000000000;type arr=record u,v,nt:longint; end; arr1=array[0..maxn] of longint;var eg:array[0..maxn*2] of... 阅读全文
摘要:
const maxn=100000;type arr=array[0..maxn] of longint;var a:arr; i,n:longint;procedure swap(var a,b:longint);var c:longint;begin c:=a; a:=b; b:=c... 阅读全文
摘要:
uses math;const maxn=105; INF=2000000000;var n,m,i,x,y,sum,ans,delta:longint; map:array[0..maxn,0..maxn] of longint; flag:array[0..maxn] of... 阅读全文
摘要:
type arr=record v,nt:longint; end;const maxn=10008; lx=20;var lt:array[0..maxn] of longint; eg:array[0..maxn*2] of arr; d:array[0..maxn] of ... 阅读全文
摘要:
const lx=100004; xh=27;var L,p,nt:array[0..lx*2] of longint; lt,dfn,fr,dep:array[0..lx] of longint; f:array[0..lx*2,0..xh] of longint; ... 阅读全文
摘要:
博弈问题若你想仔细学习博弈论,我强烈推荐加利福尼亚大学的Thomas S. Ferguson教授精心撰写并免费提供的这份教材,它使我受益太多。(如果你的英文水平不足以阅读它,我只能说,恐怕你还没到需要看“博弈论”的时候。)Nim游戏是博弈论中最经典的模型(之一?),它又有着十分简单的规则和无比优美的... 阅读全文
摘要:
const maxn=600008; len=24; var x,y,z,n,m,tot,lx,i:longint; sum:array[0..maxn] of longint; rt:array[0..maxn] of longint; time,l,r:array[0..maxn*len] of longint; ch:char; procedur... 阅读全文
摘要:
1 type xh=record 2 x,y:double; 3 end; 4 arr=array[0..1000008] of xh; 5 var n,m:longint; 6 s1,s2:ansistring; 7 a,b,g,w:a... 阅读全文
摘要:
type arr=record u,v,w,nt:longint; end; var i,j,m,n,x,y:longint; ans:int64; a:array[0..200008] of arr; fa:array[0..200008] of longint; function find(x:longint):longint; beg... 阅读全文
摘要:
var a:array[0..208,0..208] of int64; mo:int64; i,j,n,temp:longint;function guess:int64;var i,j,k,t:longint; ans:int64;begin ans:=1; for... 阅读全文
摘要:
斜率DP设dp[i][j]表示前i点,炸掉j条边的最小值。jky(q[h+1],q[h])) do inc(h); f[i,j]:=-sum[i]*sum[q[h]]+f[q[h],j-1]-cost[q[h]]+sum[q[h]]*sum[q[h]]+cost[i]; ... 阅读全文
摘要:
var b,f:array[0..100000] of longint; s,t,i,j,n,m,x,y:longint; l,h:array[0..1000]of longint; a:array[0..1000,0..1000]of longint; procedure bfs; var i,head,tail,x,y:longint; begin fillchar(b,... 阅读全文