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

Crash (access violation) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Momchil Tomov 20 May 2007 13:57
on test # 1......................
if i get it again, i'm gonna break something....
it runs perfectly on my compiler


#include <stdio.h>
#include <iostream>
#include <vector>
#define PB push_back

using namespace std;

int lev[110];

int main()
{
  int i,j,k,l,n,s,e,v;
  int q[10100];
  vector<int> a[110];
  scanf("%d",&n);
//  cin>>n;
  for (i=1; i<=n; i++)
   {
     while (1)
     {
      scanf("%d",&j);
//  cin>>j;
      if (j!=0) a[i].PB(j); else break;
     }
   }


  for (i=1; i<=n; i++)
  if (!lev[i])
{
  q[0]=i; e=0;
  for (s=0; s<=e; s++)
   {
      for (j=0; j<a[q[s]].size(); j++)
       {
        v=a[q[s]][j];
        lev[v]=lev[q[s]]+1;
        q[e++]=v;
       }
   }
}

  vector<int> ans;
  for (i=1; i<=n; i++)
   if (lev[i]%2) ans.PB(i);

  printf("%d\n",ans.size());
  for (i=0;i<ans.size()-1; i++)
   printf("%d ",ans[i]);
  printf("%d\n",ans[ans.size()-1]);

  return 0;
}
Re: Crash (access violation) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Alias (Alexander Prudaev) 21 May 2007 09:19
2
0
0
Re: Crash (access violation) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by TIA (Lyceum #165) 7 Jan 2008 19:50
Alias (Alexander Prudaev) wrote 21 May 2007 09:19
2
0
0
Every member has one or more friends in the group!!!
Re: Crash (access violation) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Bogatyr 22 Nov 2012 03:47
> Every member has one or more friends in the group!!!

The problem statement does not say this.  It says that friendship is mutual (the friendship must exist for this to be true), and  that the friendship list is terminated by a 0.   So it is allowed for a member to have no friends.