ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1106. Two Teams

Test case # 11 fails for me.
Posted by grey under sky 2 Aug 2007 21:06
#include <iostream>
using namespace std;
long f[101],n;
int main()
  {
    long i,t,c=0;
    cin>>n;
    for (i=1;i<=n;i++)
      {
        if (f[i]==0) f[i]=1;
        while (true)
          {
            cin>>t;
            if (t==0) break;
            if (f[t]==0) f[t]=1+(f[i]==1);
          }
        if (f[i]==1) c++;
      }
    cout<<c<<endl;
    for (i=1;i<=n;i++)
        if (f[i]==1) cout<<i<<" ";
  }

why??
Re: Test case # 11 fails for me.
Posted by Olympic Bear 20 Oct 2007 02:56
I had WA 11, this test helped me:

4
2 0
1 4 0
4 0
2 3 0

Edited by author 30.10.2007 04:07
Re: Test case # 11 fails for me.
Posted by Programmer007 4 Jun 2013 09:49
Thank You!
Re: Test case # 11 fails for me.
Posted by saurav prakash 25 Sep 2014 02:30
thanks
Re: Test case # 11 fails for me.
Posted by Dhruv Somani 27 Apr 2016 16:37
What's the main idea behind it?