求此程序流程图
#include<iostream>#include<cstdio>
#include<cstring>
using namespace std;
const int MAX = 1010;
int a[MAX][MAX], p[MAX], q[MAX];
int b[MAX][MAX], c[MAX][MAX];
int n;
int main()
{
// freopen("a.txt","r",stdin);
int i, j, s, t, k, x;
while(scanf("%d",&n)!=EOF)
{
for(i = 1; i <= n; ++ i)
for(j = 1; j <= n; ++ j)
scanf("%d",&a[i][j]);
for(i = 1; i <= n; ++ i)
for(j = 1; j <= n; ++ j)
{
scanf("%d",&k);
b[i][j] = k;
c[i][k] = j;
}
for(i = 1; i <= n; ++ i)
p[i] = 1;
for(x = 0; !x ;)
{
x = 1;
memset(q,0,sizeof(q));
for(i = 1; i <= n; ++ i)
{
j = a[i][p[i]];
if(q[j] == 0) q[j] = i;
else
{
x = 0;
s = c[j][i];
t = c[j][q[j]];
if(s > t) p[i] ++;
else p[q[j]] ++, q[j] = i;
}
}
}
for(i = 1; i <= n; ++ i)
printf("%d\n",a[i][p[i]]);
}
return 0;
}