結果
問題 | No.323 yuki国 |
ユーザー | Leonardone |
提出日時 | 2015-12-16 23:46:34 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,440 bytes |
コンパイル時間 | 153 ms |
コンパイル使用メモリ | 7,168 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-16 06:09:31 |
合計ジャッジ時間 | 1,805 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 11 ms
6,816 KB |
testcase_01 | AC | 11 ms
6,944 KB |
testcase_02 | AC | 9 ms
6,940 KB |
testcase_03 | AC | 9 ms
6,940 KB |
testcase_04 | AC | 9 ms
6,940 KB |
testcase_05 | AC | 10 ms
6,940 KB |
testcase_06 | AC | 10 ms
6,944 KB |
testcase_07 | AC | 9 ms
6,940 KB |
testcase_08 | AC | 10 ms
6,944 KB |
testcase_09 | AC | 11 ms
6,940 KB |
testcase_10 | WA | - |
testcase_11 | AC | 10 ms
6,940 KB |
testcase_12 | AC | 10 ms
6,940 KB |
testcase_13 | AC | 14 ms
6,944 KB |
testcase_14 | AC | 10 ms
6,944 KB |
testcase_15 | AC | 41 ms
6,940 KB |
testcase_16 | AC | 13 ms
6,940 KB |
testcase_17 | AC | 27 ms
6,940 KB |
testcase_18 | AC | 12 ms
6,940 KB |
testcase_19 | AC | 9 ms
6,940 KB |
testcase_20 | AC | 16 ms
6,940 KB |
testcase_21 | AC | 10 ms
6,940 KB |
testcase_22 | AC | 15 ms
6,940 KB |
testcase_23 | AC | 10 ms
6,940 KB |
testcase_24 | AC | 17 ms
6,944 KB |
testcase_25 | AC | 10 ms
6,940 KB |
testcase_26 | AC | 14 ms
6,944 KB |
testcase_27 | AC | 9 ms
6,944 KB |
testcase_28 | AC | 12 ms
6,940 KB |
testcase_29 | AC | 12 ms
6,944 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 9 ms
6,944 KB |
ソースコード
# coding: utf-8 # yukicoder My Practice # author: Leonardone @ NEETSDKASU def gis(): return map(int, raw_input().split()) def arr2d(h,w): return [[0] * w for _ in xrange(h)] def solve(): ansYes = "Yes" ansNo = "No" pCh = "*" mCh = "." (h,w) = gis() (a, si, sj) = start = gis() (b, gi, gj) = goal = gis() m = [raw_input() for _ in xrange(h)] l = abs(si - gi) + abs(sj - gj) if l % 2 == 0 and a % 2 != b % 2: print ansNo return if l % 2 == 1 and a % 2 == b % 2: print ansNo return minus = arr2d(h,w) plus = arr2d(h,w) def chk(rch2, c, y2, x2): if m[y2][x2] == pCh: if plus[y2][x2] == 0: rch2.append([c + 1, y2, x2]) plus[y2][x2] = 1 elif c > 1 and minus[y2][x2] < c - 1: rch2.append([c - 1, y2, x2]) minus[y2][x2] = c - 1 rch1 = [start] while len(rch1) > 0: rch2 = [] for (c,y,x) in rch1: if x > 0: chk(rch2, c, y, x - 1) if y > 0: chk(rch2, c, y - 1, x) if x + 1 < w: chk(rch2, c, y, x + 1) if y + 1 < h: chk(rch2, c, y + 1, x) rch1 = rch2 mcount = 0 for ml in m: mcount += ml.count(mCh) if mcount < 2 and a + l > b: print ansYes return gplus = False if m[gi][gj] == pCh: if gi > 0 and m[gi - 1][gj] == pCh: gplus = True if gj > 0 and m[gi][gj - 1] == pCh: gplus = True if gi + 1 < h and m[gi + 1][gj] == pCh: gplus = True if gj + 1 < w and m[gi][gj + 1] == pCh: gplus =True if gplus: print ansYes return if plus[gi][gj] > 0: print ansYes return flagP = False for i in xrange(h): for j in xrange(1,w): if plus[i][j] > 0 and plus[i][j - 1] > 0: flagP = True for j in xrange(w): for i in xrange(1,h): if plus[i][j] > 0 and plus[i - 1][j] > 0: flagP = True if flagP: if m[gi][gj] == pCh and gplus == False: print ansNo return print ansYes return if minus[gi][gj] > 0: print ansYes return print ansNo solve()