QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#415947#8721. 括号序列feecle6418WA 0ms3680kbC++17925b2024-05-21 12:58:172024-05-21 12:58:18

Judging History

你现在查看的是最新测评结果

  • [2024-05-21 12:58:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3680kb
  • [2024-05-21 12:58:17]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> A, B;
int iswin() {
	int mxC = 0, mxA = -1;
	for (int i = 0; i < n; i++) {
		mxC = max(mxC, min(A[i], B[i]));
		if (A[i] < B[i]) mxA = max(mxA, A[i]);
	}
	for (int i = 0; i < n; i++) {
		if (A[i] < B[i] && A[i] == mxC) return 1;
	}
	if (mxC == 0) return 0;
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (min(A[i], B[i]) == mxC) cnt++;
	}
	if (cnt > 1) return 0;
	for (int i = 0; i < n; i++) {
		if (A[i] == B[i] && A[i] == mxC) return 1;
	}
	if (mxA == -1) return 0;
	cnt = 0;
	for (int i = 0; i < n; i++) {
		if (min(A[i], B[i]) > mxA) cnt++;
	}
	if (cnt > 1) return 0;
	return 1;
}
int main() {
	int t;
	scanf("%d", &t);
	while (t--) {
		scanf("%d", &n);
		A.resize(n), B.resize(n);
		for (auto &i : A) scanf("%d", &i);
		for (auto &i : B) scanf("%d", &i);
		if (iswin()) puts("Alice");
		else puts("Bob");
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3680kb

input:

3

output:

Bob
Bob
Bob

result:

wrong output format Expected integer, but "Bob" found