1 (*
2 *Problem: NOI2008 自愿者招募
3 *Author : Chen Yang
4 *Time : 2012.5.18
5 *State : AC
6 *Memo : 网络流
7 *)
8 program employee;
9 uses math;
10 const max=100000000;
11 maxn=2020;
12 type
13 ty1=^ty2;
14 ty2=record
15 x,f,v,fa:longint;
16 next,up:ty1;
17 end;
18
19 var
20 n,m,s,t,flow,tot,ans:longint;
21 first,fa:array[0..maxn] of ty1;
22 dui,dis,mflow:array[0..maxn] of longint;
23 get:array[0..maxn] of boolean;
24 //==================
25 procedure insert(x,y,f,v:longint); inline;
26 var
27 p,q:ty1;
28 begin
29 new(p);
30 p^.x:=y; p^.f:=f; p^.v:=v; p^.fa:=x;
31 p^.next:=first[x]; first[x]:=p;
32 new(q);
33 q^.x:=x; q^.f:=0; q^.v:=-v; q^.fa:=y;
34 q^.next:=first[y]; first[y]:=q;
35 p^.up:=q; q^.up:=p;
36 end;
37 //==================
38 procedure built;
39 var
40 i,x,y,z:longint;
41 begin
42 read(n,m);
43 s:=0; t:=n+2; y:=0;
44 for i:=1 to n do
45 begin
46 read(x);
47 if x-y>0 then begin insert(s,i,x-y,0); inc(tot,x-y); end
48 else if x-y<0 then insert(i,t,y-x,0);
49 y:=x;
50 insert(i+1,i,max,0);
51 end;
52 insert(n+1,t,x,0);
53 for i:=1 to m do
54 begin
55 read(x,y,z);
56 insert(x,y+1,max,z);
57 end;
58 end;
59 //==================
60 procedure spfa;
61 var
62 l,r,x:longint;
63 p:ty1;
64 begin
65 fillchar(get,sizeof(get),false);
66 fillchar(dis,sizeof(dis),$7);
67 fillchar(mflow,sizeof(mflow),$7);
68 l:=0; r:=1; dui[1]:=s; dis[s]:=0;
69 while l<>r
uWww Nudeactressworld R E Nudity N N Nude Actress World Pages Classic1 Shtml En 1 Nude Actress World 【NOI2008】 志愿者招募 - datam - 博客园o Wwww.3777.com b Darktube Nude Actress World
xWww Nudeactressworld R E Nudity N N Nude Actress World Pages Classic1 Shtml En 1 Nude Actress World 【NOI2008】 志愿者招募 - datam - 博客园y j Oumeilunli