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 1022. Genealogical Tree

BBBBBBBBUG!!!
Posted by vagrant 22 Oct 2010 22:10
#include<iostream>
using namespace std;
void main()
{
    int n,i=0,t,a[102]={-1};
    cin>>n;
    int num[1020]={-1};
    for(int j=1;j<=n;j++)
    {
        do
        {
            i++;
            cin>>num[i];
        }while(num[i]!=0);
        t=num[1];
        num[1]=0;
        for(int m=2;m<i;m++)
        {
            if(t<num[m])
                t=num[m];
            num[m]=0;
        }
        a[j]=t;
    }
    for(int j=1;j<=n;j++)
    {
        t=j;
        for(int m=1;m<=n;m++)
        {
            if(a[t]<a[m])
                t=m;
        }
        cout<<t<<" ";
        a[t]=-1;
    }
}

AAAAACCEPTED!!!!!
WHY?