⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1934.cpp

📁 这是哈尔滨工业大学acmOJ的源代码
💻 CPP
字号:
/*  This Code is Submitted by wywcgs for Problem 1934 on 2006-07-19 at 13:37:36 */ 
#include <cstdio>
#include <algorithm>
using namespace std;

const int N = 32;

bool best(int[][N], int, int, int);

int main()
{
	int n, m, i, j;
	int a[N][N], b[N][N], nash[N*N];
	
	while(scanf("%d %d", &n, &m) != EOF && n != 0) {
		for(i = 0; i < n; i++)
			for(j = 0; j < m; j++) scanf("%d", &a[j][i]);
		for(i = 0; i < n; i++)
			for(j = 0; j < m; j++) scanf("%d", &b[i][j]);
		int kn = 0;
		for(i = 0; i < n; i++)
			for(j = 0; j < m; j++)
				if(best(a, j, n, a[j][i]) && best(b, i, m, b[i][j])) nash[kn++] = (i<<10) | j;
		printf("%d\n", kn);
		for(i = 0; i < kn; i++) printf("%d %d\n", (nash[i]>>10)+1, (nash[i]&31)+1);
	}
	
	return 0;
}

bool best(int m[][N], int ln, int n, int e)
{
	int i;
	for(i = 0; i < n; i++)
		if(m[ln][i] > e) return false;
	return true;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -