結果

問題 No.3606 Ice Grid Game
コンテスト
ユーザー tassei903
提出日時 2026-07-31 21:54:48
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 1,920 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 427 ms
コンパイル使用メモリ 95,984 KB
実行使用メモリ 86,400 KB
最終ジャッジ日時 2026-07-31 21:54:51
合計ジャッジ時間 2,815 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
# input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

"""

ある色について,

色 i で長さ j にをとるときの最大値

"""

from functools import cache

def naive(h, w, r, c):

    @cache
    def saiki(now, x, y):
        # print(bin(now), x, y)
        for dx, dy in [[1, 0], [-1, 0], [0, 1],[0, -1]]:
            nx = x + dx
            ny = y + dy
            if 0 <= nx < h and 0 <= ny < w and not (now >> (nx * w + ny) & 1):
                z = now
                nx = x
                ny = y
                while 0 <= nx + dx < h and 0 <= ny + dy < w:
                    z |= 1 << (nx * w + ny)
                    nx += dx
                    ny += dy
                if not saiki(z, nx, ny):
                    return 1
        return 0
    
    return saiki(0, r, c)

def solve(h, w, r, c):
    if min(h, w) >= 4:
        return (r == 0 or r == h - 1) != (c == 0 or c == w - 1)
    elif min(h, w) >= 3:
        return (0 < r < h - 1) or (0 < c < w - 1)
    elif h == w == 1:
        return 0
    else:
        return 1
            

# for h in range(1, 12):
#     for w in range(h, 12):
#         f = [[0] * w for i in range(h)]
#         for r in range(h):
#             for c in range(w):
#                 if solve(h, w, r, c) != naive(h, w, r, c):
#                     print(h, w, r, c)
#                 f[r][c] = naive(h, w, r, c)
#         # print(h, w)
#         # for i in range(h):
#         #     print(*f[i])
#         # print()

for _ in range(ni()):
    h, w, r, c = na()
    r -= 1
    c -= 1
    if solve(h, w, r, c):
        print("Alice")
    else:
        print("Bob")
0