其他分享
首页 > 其他分享> > 2022.5.13 AcWing每日一题

2022.5.13 AcWing每日一题

作者:互联网

模拟

#include <bits/stdc++.h>
using namespace std;

const int N = 20;
int a[N], b[N];
int t;

bool check(int a[], int b[]) {
	int w = 0, l = 0;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			if (a[i] > b[j])
				w++;
			if (b[j] > a[i])
				l++;
		}
	}
	if (w > l)
		return true;
	else
		return false;
}

bool find(int a[], int b[]) {
	for (int i = 1; i <= 10; i++) {
		for (int j = 1; j <= 10; j++) {
			for (int k = 1; k <= 10; k++) {
				for (int m = 1; m <= 10; m++) {
					int c[4] = {i, j, k, m};
					if (check(a, b) && check(b, c) && check(c, a)) {
						return true;
					}
					if (check(b, a) && check(a, c) && check(c, b)) {
						return true;
					}
				}
			}
		}
	}

	return false;
}

int main() {
	scanf("%d", &t);
	while (t--) {
		for (int i = 0; i < 4; i++)
			scanf("%d", &a[i]);
		for (int i = 0; i < 4; i++)
			scanf("%d", &b[i]);
		if (find(a, b))
			printf("yes\n");
		else
			printf("no\n");
	}

	return 0;
}

标签:std,13,return,int,++,bool,2022.5,AcWing
来源: https://www.cnblogs.com/superPG/p/16265342.html