結果
問題 | No.1588 Connection |
ユーザー |
![]() |
提出日時 | 2021-07-08 23:08:30 |
言語 | PyPy3 (7.3.8) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,562 bytes |
コンパイル時間 | 231 ms |
使用メモリ | 101,060 KB |
平均クエリ数 | 488.69 |
最終ジャッジ日時 | 2023-02-15 01:04:43 |
合計ジャッジ時間 | 6,850 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 107 ms
91,668 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 110 ms
91,620 KB |
testcase_10 | AC | 111 ms
90,836 KB |
testcase_11 | AC | 110 ms
91,472 KB |
testcase_12 | AC | 123 ms
91,792 KB |
testcase_13 | AC | 122 ms
91,140 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 273 ms
99,292 KB |
testcase_22 | AC | 283 ms
101,060 KB |
testcase_23 | AC | 181 ms
96,624 KB |
testcase_24 | AC | 147 ms
96,164 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 281 ms
98,676 KB |
testcase_30 | AC | 282 ms
98,820 KB |
testcase_31 | AC | 109 ms
91,280 KB |
ソースコード
import sys from collections import deque sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N,M = MI() board = [[-1]*N for _ in range(N)] board[0][0] = 1 board[-1][-1] = 1 directions0 = [(1,0),(0,1)] directions1 = [(-1,0),(0,-1)] deq = deque([(0,0)]) while deq: i,j = deq.pop() for di,dj in directions0: ni,nj = i+di,j+dj if not (0 <= ni < N and 0 <= nj < N): continue if ni == nj == N-1: print('Yes',flush=True) exit() if board[ni][nj] != -1: continue print(ni+1,nj+1,flush=True) T = S() if T == 'Black': board[ni][nj] = 1 deq.append((ni,nj)) else: board[ni][nj] = 0 for di,dj in directions1: ni,nj = i+di,j+dj if not (0 <= ni < N and 0 <= nj < N): continue if ni == nj == N-1: print('Yes',flush=True) exit() if board[ni][nj] != -1: continue print(ni+1,nj+1,flush=True) T = S() if T == 'Black': board[ni][nj] = 1 deq.appendleft((ni,nj)) else: board[ni][nj] = 0