Submission #49555236


Source Code Expand

#include<bits/stdc++.h>
#define int long long
#define lowbit(x) (x&-x) 
using namespace std;
inline int read(){
	int x=0,y=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') y=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+(ch^48);
		ch=getchar();
	}
	return x*y;
} 
const int INF=1e10;
int T,n,a[200010],b[200010];
void solve(){
	n=read();
	a[0]=-INF,a[n+1]=INF;
	for(int i=1;i<=n;i++){
		a[i]=read();
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		b[i]=read();
	}
	sort(b+1,b+n+1);
	int mx=0;
	for(int i=1;i<=n;i++){
		if(min(a[i]-a[i-1],a[i+1]-a[i])>=b[1]) continue;
		if(a[i]+a[(i==n)?n-1:n]<=b[n]) continue;
		mx=max(mx,i);
	}
	if(mx==0){
		puts("Bob");
		return;
	}
	for(int i=1,j=(a[mx+1]-a[mx]>a[mx]-a[mx-1])?mx-1:mx+1;i<=n;i++){
		while(a[mx]+a[j]<=b[i]||j==mx) j++;
		if(abs(a[mx]-a[j])>=b[i]){
			puts("Bob");
			return;
		}
	}
	puts("Alice");
	return;
}
signed main(){
	T=read();
	while(T--){
		solve();
	}
	return 0;
}

Submission Info

Submission Time
Task D - Triangle Card Game
User wrhaco
Language C++ 20 (gcc 12.2)
Score 700
Code Size 1008 Byte
Status AC
Exec Time 35 ms
Memory 6620 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 1
AC × 56
Set Name Test Cases
Sample 00_sample_01.txt
All 00_sample_01.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt, 02_handmade_07.txt, 02_handmade_08.txt, 02_handmade_09.txt, 02_handmade_10.txt, 02_handmade_11.txt, 02_handmade_12.txt, 02_handmade_13.txt, 02_handmade_14.txt, 02_handmade_15.txt, 02_handmade_16.txt, 02_handmade_17.txt, 02_handmade_18.txt, 02_handmade_19.txt, 02_handmade_20.txt, 02_handmade_21.txt, 02_handmade_22.txt, 02_handmade_23.txt, 02_handmade_24.txt, 02_handmade_25.txt, 02_handmade_26.txt, 02_handmade_27.txt, 02_handmade_28.txt, 02_handmade_29.txt, 02_handmade_30.txt, 02_handmade_31.txt, 02_handmade_32.txt, 02_handmade_33.txt, 02_handmade_34.txt, 02_handmade_35.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 3380 KiB
01_test_01.txt AC 33 ms 5624 KiB
01_test_02.txt AC 33 ms 4908 KiB
01_test_03.txt AC 33 ms 5172 KiB
01_test_04.txt AC 32 ms 4776 KiB
01_test_05.txt AC 34 ms 5416 KiB
01_test_06.txt AC 32 ms 5256 KiB
01_test_07.txt AC 34 ms 5780 KiB
01_test_08.txt AC 35 ms 6524 KiB
01_test_09.txt AC 34 ms 5856 KiB
01_test_10.txt AC 34 ms 5500 KiB
01_test_11.txt AC 22 ms 3464 KiB
01_test_12.txt AC 23 ms 3576 KiB
01_test_13.txt AC 22 ms 3660 KiB
01_test_14.txt AC 23 ms 3448 KiB
01_test_15.txt AC 22 ms 3452 KiB
01_test_16.txt AC 22 ms 3508 KiB
01_test_17.txt AC 23 ms 3516 KiB
01_test_18.txt AC 22 ms 3524 KiB
01_test_19.txt AC 22 ms 3504 KiB
01_test_20.txt AC 22 ms 3480 KiB
02_handmade_01.txt AC 32 ms 6616 KiB
02_handmade_02.txt AC 8 ms 3496 KiB
02_handmade_03.txt AC 8 ms 3500 KiB
02_handmade_04.txt AC 8 ms 3568 KiB
02_handmade_05.txt AC 8 ms 3656 KiB
02_handmade_06.txt AC 8 ms 3516 KiB
02_handmade_07.txt AC 9 ms 3464 KiB
02_handmade_08.txt AC 9 ms 3488 KiB
02_handmade_09.txt AC 9 ms 3504 KiB
02_handmade_10.txt AC 9 ms 3580 KiB
02_handmade_11.txt AC 9 ms 3464 KiB
02_handmade_12.txt AC 9 ms 3460 KiB
02_handmade_13.txt AC 13 ms 6620 KiB
02_handmade_14.txt AC 13 ms 6580 KiB
02_handmade_15.txt AC 14 ms 6588 KiB
02_handmade_16.txt AC 15 ms 6588 KiB
02_handmade_17.txt AC 12 ms 4252 KiB
02_handmade_18.txt AC 11 ms 4216 KiB
02_handmade_19.txt AC 11 ms 4276 KiB
02_handmade_20.txt AC 11 ms 4252 KiB
02_handmade_21.txt AC 11 ms 4140 KiB
02_handmade_22.txt AC 11 ms 4252 KiB
02_handmade_23.txt AC 11 ms 4308 KiB
02_handmade_24.txt AC 13 ms 4188 KiB
02_handmade_25.txt AC 12 ms 4292 KiB
02_handmade_26.txt AC 13 ms 4240 KiB
02_handmade_27.txt AC 13 ms 4276 KiB
02_handmade_28.txt AC 13 ms 4196 KiB
02_handmade_29.txt AC 12 ms 4036 KiB
02_handmade_30.txt AC 12 ms 4196 KiB
02_handmade_31.txt AC 12 ms 4148 KiB
02_handmade_32.txt AC 11 ms 4332 KiB
02_handmade_33.txt AC 11 ms 4180 KiB
02_handmade_34.txt AC 12 ms 4132 KiB
02_handmade_35.txt AC 12 ms 4216 KiB