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:好心人能不能帮我看下啊,我弄了一个下午还是WA,真不知哪里错了,真的好崩溃啊,万分感谢各位啊

Posted by zjut020 at 2008-12-28 23:56:38 on Problem 2236
In Reply To:好心人能不能帮我看下啊,我弄了一个下午还是WA,真不知哪里错了,真的好崩溃啊,万分感谢各位啊 Posted by:20062449 at 2008-07-28 17:21:06
> #include<iostream>
> #include<string>
> using namespace std;
> struct sign_data
> {
>        char chardata;
> };
> sign_data sign[500000];
> int pare[500000],n,d;
> int cfind(int x)
> {
>     if(x!=1)
>     {
>             if(sign[x].chardata=='O')
>            {
>                               for(int i=x-1;i>=(x-d)&&(i>=1);i--)
>                      {
>                               if(sign[i].chardata=='O'){pare[x]=i;return pare[x];}
>                       }
>             }
>             else pare[x]=x;
>     }
>     else pare[x]=x;
>     return pare[x];
> }
> int un_ion(int x,int y)
> {
>     while(cfind(x)!=x)x=pare[x];
>      while(cfind(y)!=y)y=pare[y];
>      if(x==y){cout<<"SUCCESS"<<endl;return 1;}
>      else {cout<<"FAIL"<<endl;return 1;}
> }
> int main()
> {
>     for(int i=1;i<500000;i++)
>     {pare[i]=i;}
>     cin>>n>>d;
>     int x,y,j=0,x1,y1;
>     char z,z1;
>     while(j<n)
>     {
>               cin>>x>>y;
>               j++;
>     }
>     while( cin>>z)
>     {
>           if(z=='O'){cin>>x;sign[x].chardata='O';}
>         if(z=='S'){
>                      cin>>x>>y;
>                      un_ion(x,y);
>                      //cout<<sign[5].chardata;
>     
>                   }
>     }
>     //system("pause");
>     return 1;
> }
哇,ls合工大的,,我也是合肥的耶

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