| 
 | 
back to boardGuys whats wrong with test #3 #include <iostream> using namespace std; bool Chekcker(int A[],int k) {     int i,j,v;     bool circle=true;     for(j=1;j<=k;j++)         for(v=1;v<=k;v++)         {             if(A[v]==0 && A[j]==v )                 A[j]=0;         }
      for(j=1;j<=k;j++)         for(v=1;v<=k;v++)         {             if(A[j]==0 && A[v]==j )                 A[v]=0;         }     for(v=1;v<=k;v++)         if(A[v]==0)         { circle=true;}         else{circle=false;break;}       return circle; }   int main() {     int n;     cin>>n;     int i,j,k = 0,v;     int temK;     bool circle;     int conf;     int A[30000];     for(i=1;i<=n;i++)     {         cin>>k;         j=1;         v=1;         temK=k;         circle=true;         conf=0;
          for(j=1;j<=k;j++)         {             cin>>A[j];
          }
          for(j=1;j<=k;j++)         {             if(A[j]==0)             conf++;         }
 
 
          circle=Chekcker(A,k);
          if(conf==0 || conf>1)         {circle=false;}
          if(circle==true)             cout<<"YES"<<endl;         else             cout<<"NO"<<endl;
          for(v=1;v<=k;v++)             A[v]=0;           }  
 
         return 0; }     this code get correct on every test in the forum, however fails test #3. Whats Wrong????  |  
  | 
|