|
|
back to boardTest case # 11 fails for me. #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. 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. Thank You! Re: Test case # 11 fails for me. thanks Re: Test case # 11 fails for me. What's the main idea behind it? |
|
|