#include <stdio.h> #include <algorithm> #include <string.h> #include <vector> #include < Iostream>using namespace Std;struct node{int wei[40];} Ed[40];int n,m;int dp[40];vector<int> map[40];int path[40];int dfs (int u) {if (Dp[u]) return dp[u]; for (int i = 0; i < map[u].size (); ++i) {int v = map[u][i]; int t = DFS (v) + 1; if (Dp[u] < T) dp[u] = t, path[u] = v; } return dp[u];} BOOL Judge (int a,int b) {int i;bool flag=true;for (i=1;i<=m;i++) {if (Ed[a].wei[i]>=ed[b].wei[i]) {flag=false; Break;}} return flag;} int main () {int i,j;while (scanf ("%d%d", &n,&m)!=eof) {for (i=1;i<=n;i++) {for (j=1;j<=m;j++) {scanf ("%d", &ED[I].WEI[J]);} Sort (ed[i].wei+1,ed[i].wei+m+1); Map[i].clear ();} for (i=1;i<=n;i++) {for (j=1;j<=n;j++) {if (Judge (i,j) &&i!=j) Map[i].push_back (j);}} int Ans=0,lu=0;memset (Dp,0,sizeof (DP)); for (i=1;i<=n;i++) {int Hui=dfs (i); if (Ans
Memory Search UVA 103