結果

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

ソースコード

diff #
raw source code

Q=int(input())
for _ in range(Q):
  H,W,a,b=map(int,input().split())
  a-=1
  b-=1
  DX=[1,0,-1,0]
  DY=[0,1,0,-1]
  ans='Bob'
  for i in range(4):
    dx,dy=DX[i],DY[i]
    if 0<=a+dx<H and 0<=b+dy<W:
      t=False
      for j in range(4):
        dx,dy=DX[i],DY[i]
        used=[[False]*W for i in range(H)]
        nowx,nowy=a,b
        while True:
          used[nowx][nowy]=True
          if 0<=nowx+dx<H and 0<=nowy+dy<W:
            nowx+=dx
            nowy+=dy
          else:
            break
        dx,dy=DX[j],DY[j]
        count=0
        if 0<=nowx+dx<H and 0<=nowy+dy<W and used[nowx+dx][nowy+dy]==False:
          nowx+=dx
          nowy+=dy
          count+=1
          while True:
            used[nowx][nowy]=True
            if 0<=nowx+dx<H and 0<=nowy+dy<W and used[nowx+dx][nowy+dy]==False:
              nowx+=dx
              nowy+=dy
            else:
              break
          while True:
            p=False
            for k in range(4):
              dx,dy=DX[k],DY[k]
              if 0<=nowx+dx<H and 0<=nowy+dy<W and used[nowx+dx][nowy+dy]==False:
                p=True
                count+=1
                nowx+=dx
                nowy+=dy
                count+=1
                while True:
                  used[nowx][nowy]=True
                  if 0<=nowx+dx<H and 0<=nowy+dy<W and used[nowx+dx][nowy+dy]==False:
                    nowx+=dx
                    nowy+=dy
                  else:
                    break
                break
            if p==False:
              break
        if count%2==1:
          t=True
      if t==True:
        ans='Alice'
  print(ans)
              
0