比赛 CSP2022提高组 评测结果 WWWWWWWWWWWWEEEEEEEE
题目名称 策略游戏 最终得分 0
用户昵称 该账号已注销 运行时间 3.887 s
代码语言 C++ 内存使用 8.12 MiB
提交时间 2022-10-30 09:51:57
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
long long n, m, q, c[1010][1010], a[1010], b[1010];
long long maxn = 200000000000000000;

int main() {
	freopen("csp2022_game.in", "r", stdin);
	freopen("csp2022_game.out", "w", stdout);
	cin >> n >> m >> q;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= m; i++) {
		cin >> b[i];
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			c[i][j] = a[i] * b[j];
		}
	}
	for (int i = 1; i <= q; i++) {
		int l1, l2, r1, r2;
		long long ans = -maxn;
		scanf("%d%d%d%d", &l1, &r1, &l2, &r2);
		for (int j = l1; j <= r1; j++) {
			long long u = maxn;
			for (int k = l2; k <= r2; k++) {
				u = min(u, c[j][k]);
			}
			ans = max(ans, u);
		}
		printf("%lld\n", ans);
	}
	return 0;
}