ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1203. Scientific Conference

Posted by Tigran Hakobyan(1 course RAU) 7 Feb 2010 00:11
#include <iostream.h>
int maximum(int x[],int n)
{
int i,max;
max=x[0];
for(i=0;i<n;i++)
{
if(max<x[i])
{
max=x[i];
}
}
return max;
}
const int N=100;
int main()
{
int x[N][2],i,j,total=1,min,max,n,y[N][2],c[N],b[N],g,h;
cin>>n;
if(n==0)
{
cout<<"0"<<endl;
}
else
{
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
cin>>x[i][j];
}
}
int *u,l=0;
u=new int [n];
for(i=0;i<n;i++)
{
c[i]=x[i][0];
b[i]=x[i][1];
}
for(i=0;i<n;i++)
{
for(j=n-1;j>i;j--)
{
if(c[j-1]>c[j])
{
g=c[j-1];
h=b[j-1];
c[j-1]=c[j];
b[j-1]=b[j];
c[j]=g;
b[j]=h;
}
}
}
for(i=0;i<n;i++)
{
x[i][0]=c[i];
x[i][1]=b[i];
}
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
y[i][j]=x[i][j];
}
}
for(i=0;i<n;i++)
{
max=x[i][1];
for(j=0;j<n;j++)
{
if(max<y[j][0])
{
total++;
max=y[j][1];
}
}
u[l]=total;
l++;
total=1;
}
cout<<maximum(u,l)<<endl;
}
return 0;
}