結果
| 問題 |
No.2476 Knight Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-23 22:49:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 1,921 bytes |
| コンパイル時間 | 1,777 ms |
| コンパイル使用メモリ | 167,132 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-16 22:33:25 |
| 合計ジャッジ時間 | 4,178 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair < int , int > pii ;
typedef vector < int > vi ;
#define fi first
#define se second
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
void solve ( ) {
ll n , m , x , y ;
cin >> n >> m >> x >> y ;
if ( n > m ) { swap ( n , m ) , swap ( x , y ) ; }
if ( n == 1 ) {
cout << "Bob\n" ;
return ;
}
if ( n == 2 ) {
int lenl = ( y - 1 ) / 2 + 1 , lenr = 1 + ( m - y ) / 2 ;
if ( ( lenl % 2 ) == 0 || ( lenr % 2 ) == 0 ) {
cout << "Alice\n" ;
}
else {
cout << "Bob\n" ;
}
return ;
}
if ( ( n % 2 ) == 0 || ( m % 2 ) == 0 ) {
cout << "Alice\n" ;
return ;
}
if ( n == 3 && m == 3 ) {
if ( x == 2 && y == 2 ) {
cout << "Bob\n" ;
}
else {
cout << "Alice\n" ;
}
return ;
}
if ( n == 3 && m == 5 ) {
if ( ( x + y ) % 2 == 1 ) {
cout << "Alice\n" ;
}
else {
if ( ( x == 1 || x == n ) && ( y == 1 || y == m ) ) {
cout << "Bob\n" ;
}
else if ( x == 2 && y == 2 ) {
cout << "Bob\n" ;
}
else if ( x == 2 && y == 4 ) {
cout << "Bob\n" ;
}
else {
cout << "Alice\n" ;
}
}
return ;
}
if ( ( x + y ) % 2 == 0 ) {
cout << "Bob\n" ;
}
else {
cout << "Alice\n" ;
}
}
int main ( ) {
ios_base :: sync_with_stdio ( false ) ;
cin.tie ( NULL ) ;
int t = 1 ; cin >> t ;
while ( t -- ) { solve ( ) ; }
return 0 ;
}