Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
RE到无语。。。这是我的构图 希望有高人指点。。。 struct node2 { int a,b,w; }p[401]; int a[401]; int re[1000010]; int main() { int n,k; int t; int i,j; scanf("%d",&t); for(j=1;j<=t;j++) { for(i=0;i<maxn;i++) adj[i]=NULL; len=0; scanf("%d%d",&n,&k); int pp=0; for(i=1;i<=n;i++) { scanf("%d%d%d",&p[i].a,&p[i].b,&p[i].w); pp++; a[pp]=p[i].a; pp++; a[pp]=p[i].b; } sort(a+1,a+1+2*n); int nn=1; for(i=2;i<=2*n;i++) { if(a[i]!=a[nn]) a[++nn]=a[i]; } n=nn; // //初始化 for(i=1;i<=n;i++) re[a[i]]=i; for(i=0;i<=n;i++) insert(i,i+1,k,0); for(i=1;i<=n;i++) { insert(re[p[i].a],re[p[i].b],1,-p[i].w); } printf("%d\n",-mincostflow(n+2,0,n+1)); } return 0; } 历时一天 终于过了 内流满面啊 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator