QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#456592#8722. 卡牌游戏JEdwardWA 225ms3520kbC++171.4kb2024-06-28 08:46:552024-06-28 08:46:55

Judging History

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

  • [2024-06-28 08:46:55]
  • 评测
  • 测评结果:WA
  • 用时:225ms
  • 内存:3520kb
  • [2024-06-28 08:46:55]
  • 提交

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){
	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) ++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: 100
Accepted
time: 0ms
memory: 3520kb

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:

Alice
Bob
Alice
Alice
Alice

result:

ok 5 lines

Test #2:

score: -100
Wrong Answer
time: 225ms
memory: 3436kb

input:

1000000
1
901418150
815121916
1
455099013
31761433
1
46418945
11466871
1
709189476
658667824
1
977821005
511405192
1
843598992
501074199
1
638564514
680433292
1
994431111
584582554
1
452689372
642414314
1
863578235
135133204
1
438404803
67246919
1
492858783
447116205
1
723252212
948645336
1
19105046...

output:

Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
...

result:

wrong answer 1st lines differ - expected: 'Bob', found: 'Alice'