QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#415947 | #8721. 括号序列 | feecle6418 | WA | 0ms | 3680kb | C++17 | 925b | 2024-05-21 12:58:17 | 2024-05-21 12:58:18 |
Judging History
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");
}
}
详细
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