結果

問題 No.1434 Make Maze
ユーザー KudeKude
提出日時 2021-03-19 22:49:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 649 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 84,864 KB
最終ジャッジ日時 2024-04-29 18:12:42
合計ジャッジ時間 5,940 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 46 ms
52,096 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 40 ms
52,096 KB
testcase_06 AC 40 ms
52,096 KB
testcase_07 AC 41 ms
51,712 KB
testcase_08 WA -
testcase_09 AC 40 ms
51,968 KB
testcase_10 WA -
testcase_11 AC 41 ms
52,096 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 42 ms
51,968 KB
testcase_21 AC 40 ms
52,096 KB
testcase_22 AC 41 ms
52,096 KB
testcase_23 AC 45 ms
57,472 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w, x = map(int, input().split())
r = x - (h - 1) - (w - 1)
if r < 0 or r % 4:
    print(-1)
    exit()
r //= 4
s = [[(i | j) & 1 for j in range(w)] for i in range(h)]
for i in range(h):
    s[i][0] = 0
for j in range(w):
    s[h-1][j] = 0

di = [1, 0, -1, 0]
dj = [0, 1, 0, -1]
def flip(i, j):
    for k in range(4):
        ni = i + di[k]
        nj = j + dj[k]
        s[ni][nj] ^= 1
i = h - 2
j = w - 2
while r and i > 0 and j > 0:
    r -= 1
    flip(i, j)
    i -= 2
    if i < 0:
        j -= 4
        i = h - 2
        if j == 1:
            i -= 2

if r != 0:
    print(-1)
    exit()
for si in s:
    print(''.join('.#'[x] for x in si))
0