結果

問題 No.1588 Connection
ユーザー とりゐとりゐ
提出日時 2021-07-08 23:07:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 288 ms / 2,000 ms
コード長 938 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 96,424 KB
平均クエリ数 546.59
最終ジャッジ日時 2023-09-24 11:31:44
合計ジャッジ時間 7,422 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
88,052 KB
testcase_01 AC 121 ms
87,692 KB
testcase_02 AC 118 ms
87,540 KB
testcase_03 AC 120 ms
87,416 KB
testcase_04 AC 119 ms
87,420 KB
testcase_05 AC 118 ms
88,184 KB
testcase_06 AC 119 ms
87,428 KB
testcase_07 AC 118 ms
87,876 KB
testcase_08 AC 122 ms
87,520 KB
testcase_09 AC 125 ms
87,564 KB
testcase_10 AC 129 ms
87,780 KB
testcase_11 AC 126 ms
87,732 KB
testcase_12 AC 195 ms
93,832 KB
testcase_13 AC 226 ms
95,212 KB
testcase_14 AC 119 ms
88,248 KB
testcase_15 AC 123 ms
87,548 KB
testcase_16 AC 122 ms
87,512 KB
testcase_17 AC 122 ms
87,864 KB
testcase_18 AC 120 ms
87,776 KB
testcase_19 AC 120 ms
87,564 KB
testcase_20 AC 127 ms
88,688 KB
testcase_21 AC 284 ms
95,988 KB
testcase_22 AC 284 ms
96,424 KB
testcase_23 AC 203 ms
94,540 KB
testcase_24 AC 158 ms
92,264 KB
testcase_25 AC 221 ms
95,256 KB
testcase_26 AC 224 ms
96,116 KB
testcase_27 AC 158 ms
92,612 KB
testcase_28 AC 148 ms
91,860 KB
testcase_29 AC 269 ms
94,680 KB
testcase_30 AC 288 ms
95,168 KB
testcase_31 AC 120 ms
87,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
from collections import deque,Counter
#sys.setrecursionlimit(10**7)
int1=lambda x: int(x)-1

mi=lambda :map(int,input().split())
li=lambda :list(mi())
mi1=lambda :map(int1,input().split())
li1=lambda :list(mi1())
mis=lambda :map(str,input().split())
lis=lambda :list(mis())

from collections import defaultdict
"""
d=defaultdict(int) #初期値 0
d=defaultdict(lambda:1) #初期値 1
"""

mod=10**9+7
Mod=998244353
INF=10**18
ans=0

n,m=mi()
Map=[[-1]*n for i in range(n)]
Map[0][0]=1
d=deque()
d.append([0,0])
dxdy=[[0,1],[0,-1],[1,0],[-1,0]]
while d:
  x,y=d.pop()
  for dx,dy in dxdy:
    if 0<=x+dx<n and 0<=y+dy<n:
      if Map[x+dx][y+dy]==-1:
        print(x+dx+1,y+dy+1)
        s=input()
        if s=='Black':
          Map[x+dx][y+dy]=1
          d.append([x+dx,y+dy])
          if x+dx==n-1 and y+dy==n-1:
            print('Yes')
            exit()
        else:
          Map[x+dx][y+dy]=0
print('No')
0