2010年3月27日 星期六

TIOJ 1410 Comiket [sort]

poao899    15652K    890MS    G++     0.63K     2010-03-27 20:58:10                                  .


不想說什麼了orz


只是在寫水題而已...



//************************

#include<stdio.h>
#include<algorithm>
int n,nowp,maxp,t;
int getint(){
int g=0,c=getchar();
while(c==10||c==32||c==9)c=getchar();
if(c==EOF)return -1;
while(c>='0'&&c<='9'){
g=g*10+c-48;
c=getchar();
}
return g;
}
struct peo{
int t,in;
bool operator<(const peo &b)const{
return t<b.t || t==b.t&&in>b.in;
}
}p[2000010];
int main(){
while(~(n=getint())){
nowp=maxp=t=0;
for(int i=0;i<n;i++){
p[t].t=getint();
p[t++].in=1;
p[t].t=getint();
p[t++].in=-1;
}
std::sort(p,p+t);
for(int i=0;i<t;i++){
nowp+=p[i].in;
if(nowp>maxp)maxp=nowp;
}
printf("%d\n",maxp);
}
}


沒有留言:

張貼留言