#include
int main()
{
int n;
int *start, *end, *exists;
int i,j,k;
printf("input the number of activities:");
scanf("%d",&n);
start=new int [n];
end=new int [n];
exists=new int [n];
for(i=0;i
end[j])
{
k=start[i];start[i]=start[j]; start[j]=k;
k=end[i];end[i]=end[j]; end[j]=k;
}
}
}
j=0;
exists[j]=1;
for(i=1;i
=end[j])
{
exists[i]=1;
j=i;
}
}
for(i=0;i