QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#456712 | #8722. 卡牌游戏 | JEdward | WA | 0ms | 3432kb | C++17 | 1.5kb | 2024-06-28 11:25:41 | 2024-06-28 11:25:42 |
Judging History
answer
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0), cin.tie(0)
#define int long long
#define endl '\n'
#define lowbit(x) (x)&(-x)
#define pii pair<int,int>
#define all(s) s.begin(), s.end()
#define ls(x) (x<<1)
#define rs(x) (x<<1|1)
#define here system("pause")
using namespace std;
const int N = 5e6+5;
const int mod = 998244353;
const int INF = 1e15+7;
const double eps = 1e-6;
inline int pow(int a, int b, int p){ int res = 1%p; while(b){ if(b&1) res=res*a%p; a=a*a%p, b>>=1;} return res;}
inline int inv(int a, int p){ return pow(a,p-2,p)%p;}
int n;
inline bool check(vector<int> &a, vector<int> &b){
if(n==1) return a[0] < b[0];
vector<int> c(n), op(n);
int mx = -1;
for(int i=0;i<n;i++){
c[i] = min(a[i], b[i]);
if(a[i] > b[i]) op[i] = 1;
else if(a[i] == b[i]) op[i] = 0;
else op[i] = -1;
mx = max(c[i], mx);
}
int mxcnt = 0, mxidx = -1;
for(int i=0;i<n;i++){
if(mx==c[i]){
++mxcnt;
mxidx = i;
if(op[i]==-1) return true;
}
}
if(mxcnt>1) return false;
if(!op[mxidx]) return true;
mx = mxcnt = 0;
for(int i=0;i<n;i++){
if(op[i]==-1) mx = c[i];
}
for(int i=0;i<n;i++){
if(c[i] > mx) ++mxcnt;
if(mxcnt>1) return false;
}
return true;
}
inline void sol(){
cin >> n;
vector<int> a(n), b(n);
for(auto &i:a) cin >> i;
for(auto &i:b) cin >> i;
if(check(a, b)) cout << "Alice\n";
else cout << "Bob\n";
}
signed main(){
// IOS;
int tc = 1;
cin >> tc;
while(tc--){
sol();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3432kb
input:
5 1 100 100 2 1 1 1 1 2 1 1 0 1 3 1 1 4 5 1 4 10 116 104 101 114 101 32 97 114 101 32 102 105 118 101 32 99 97 115 101 115
output:
Bob Bob Alice Alice Alice
result:
wrong answer 1st lines differ - expected: 'Alice', found: 'Bob'