Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re: 你确实 SPFA 写错勒 附上 错误 部分代码

Posted by __sunshine at 2009-05-20 13:25:16 on Problem 1860
In Reply To:Re:BellmanFord AC,SPFA为什么就WA呢?麻烦用SPFA过的同学给发份代码,或者给我看看,谢谢 Posted by:YA_ME_DE at 2009-05-06 13:55:56
while(!sqa.empty()){
           int a=sqa.front();
           sqa.pop();
           vist[a]=false;                 
           for(int i=1;i<=n;i++){
                 if(map[a][i].link==1&&result[i]+eps<(result[a]-map[a][i].com)*map[a][i].rate){
                         result[i]=(result[a]-map[a][i].com)*map[a][i].rate;
                         if(!vist[i]){
                             sqa.push(i);
                             vist[i]=true;
                         }
                         ok=true;
                 }
           }
        }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator