会场安排问题

2014-11-23 23:55:31 · 作者: · 浏览: 4
/*会场安排问题*/
#include 
#include 
using namespace std;

typedef struct _point
{
        int time;
        bool flag; //0代表开始时间,1代表结束时间 
}point;

int cmp(const void *a,const void *b)
{
    point *a1=(point *)a;
    point *b1=(point *)b;
    return a1->time-b1->time;
} 
int main()
{
    int n;
    while(cin>>n)
    {
            point *p=new point[2*n];
            for(int i=0;i>p[2*i].time;
                    p[2*i].flag=true;
                    cin>>p[2*i+1].time;
                    p[2*i+1].flag=false;
            } 
            qsort(p,2*n,sizeof(p[0]),cmp);
            int cur=0,max=0;
            for(int i=0;i