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 |
RE!!!help!!!#include<stdio.h> #include<algorithm> using namespace std; int x[501][1000],*y[501],d,b[501]; bool cmp(int *a,int *b) { int i=0; for(;i<d;i++)if(a[i]<=b[i])break; if(i<d)return true; return false; } int main() { int n; while(scanf("%d%d",&n,&d)!=EOF) { for(int i=0;i<=n;i++) { for(int j=0;j<d;j++)scanf("%d",x[i]+j); sort(x[i],x[i]+d); y[i]=x[i]; } sort(y+1,y+n+1,cmp); memset(b,0,sizeof(b)); int m=0; for(int i=1;i<=n;i++)if(cmp(y[i],x[0])==false) { b[i]=1; for(int j=1;j<i;j++)if((b[j]+1>b[i])&&(cmp(y[i],y[j])==false))b[i]=b[j]+1; if(m<b[i])m=b[i]; } if(m)printf("%d\n",m); else puts("Please look for another gift shop!"); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator