| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为啥会运行错误呢???#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
struct Point {
int x;
int y;
}point[2005];
int vist[2005];
int cmp(Point a,Point b)
{
if(a.x==b.x) return a.y<b.y;
return a.x<b.x;
}
int main()
{
int t,m;
cin>>t;
while(t--){
int i,j,num,k;
cin>>m;
for(i=0;i<m;i++)
cin>>point[i].x>>point[i].y;
sort(point,point+m,cmp);
memset(vist,0,sizeof(vist));
k=0;num=0;
while(k<m){
j=k;
vist[k]=1;
for(i=j+1;i<m;i++){
if((!vist[i])&&point[i].x>point[j].x&&point[i].y>point[j].y){
j=i;
vist[i]=1;
}
}
num++;
while(vist[k]&&k<m)
k++;
}
cout<<num<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator