結果
| 問題 | No.3606 Ice Grid Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-31 22:17:17 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,083 bytes |
| 記録 | |
| コンパイル時間 | 1,227 ms |
| コンパイル使用メモリ | 211,360 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-31 22:17:19 |
| 合計ジャッジ時間 | 2,270 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int T; cin >> T;
while(T--){
int H,W; cin >> H >> W;
int r,c; cin >> r >> c,r--,c--;
auto g = [&](int h,int w) -> bool {
if(h > w) return true;
else return false;
};
auto f = [&]() -> bool {
if(r == 0) return false;
int ret = 0;
if(c != 0){
ret++;
if(r == H-1){if(g(H,c)) ret--;}
else if(c == W-1){
if(r != H-2){
if(W == 2) ret--;
else if(!g(W-2,r) || (r < H-3 && !g(W-2,H-3-r))) ret--;
}
}
else if(c == W-2) ret--;
else{
if(r == H-2){
if(g(H,W-1-c)) ret--;
}
else{
bool lose = false;
if(c != W-3 && !g(H-2,W-3-c)) lose = true;
if(r == H-3){
if(c == 1) lose = true;
else if(!g(c-1,r)) lose = true;
}
else if(c > 2){
if(r == H-4) lose = true;
if(H > 4 && c > 3 && !g(H-4,c-3)) lose = true;
}
if(lose == false) ret--;
}
}
}
c = W-1-c;
if(c != 0){
ret++;
if(r == H-1){if(g(H,c)) ret--;}
else if(c == W-1){
if(r != H-2){
if(W == 2) ret--;
else if(!g(W-2,r) || (r < H-3 && !g(W-2,H-3-r))) ret--;
}
}
else if(c == W-2) ret--;
else{
if(r == H-2){
if(g(H,W-1-c)) ret--;
}
else{
bool lose = false;
if(c != W-3 && !g(H-2,W-3-c)) lose = true;
if(r == H-3){
if(c == 1) lose = true;
else if(!g(c-1,r)) lose = true;
}
else if(c > 2){
if(r == H-4) lose = true;
if(H > 4 && c > 3 && !g(H-4,c-3)) lose = true;
}
if(lose == false) ret--;
}
}
}
c = W-1-c;
if(ret == 0) return true;
else return false;
};
bool win = false;
win |= f(),swap(r,c),swap(H,W),c = W-1-c;
win |= f(),swap(r,c),swap(H,W),c = W-1-c;
win |= f(),swap(r,c),swap(H,W),c = W-1-c;
win |= f(),swap(r,c),swap(H,W),c = W-1-c;
if(win) cout << "Alice\n";
else cout << "Bob\n";
}
}