結果

問題 No.1434 Make Maze
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-03-19 22:28:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,643 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 83,584 KB
最終ジャッジ日時 2024-04-29 17:33:34
合計ジャッジ時間 6,285 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,096 KB
testcase_01 AC 39 ms
52,224 KB
testcase_02 AC 144 ms
83,584 KB
testcase_03 AC 149 ms
83,584 KB
testcase_04 AC 40 ms
51,840 KB
testcase_05 AC 39 ms
51,840 KB
testcase_06 AC 40 ms
52,224 KB
testcase_07 AC 39 ms
51,840 KB
testcase_08 WA -
testcase_09 AC 39 ms
52,096 KB
testcase_10 AC 39 ms
51,968 KB
testcase_11 AC 38 ms
52,224 KB
testcase_12 AC 56 ms
62,976 KB
testcase_13 WA -
testcase_14 AC 54 ms
62,208 KB
testcase_15 AC 68 ms
65,280 KB
testcase_16 AC 57 ms
62,592 KB
testcase_17 AC 52 ms
61,696 KB
testcase_18 AC 62 ms
64,000 KB
testcase_19 AC 72 ms
68,224 KB
testcase_20 AC 66 ms
66,688 KB
testcase_21 AC 40 ms
51,712 KB
testcase_22 AC 74 ms
67,968 KB
testcase_23 WA -
testcase_24 AC 73 ms
67,200 KB
testcase_25 AC 77 ms
70,016 KB
testcase_26 AC 56 ms
61,696 KB
testcase_27 AC 75 ms
66,560 KB
testcase_28 AC 58 ms
63,232 KB
testcase_29 AC 50 ms
60,032 KB
testcase_30 AC 62 ms
63,360 KB
testcase_31 AC 62 ms
62,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""



"""

import sys
from sys import stdin

H,W,X = map(int,stdin.readline().split())
ox = X

if X % 2 == 1:
    print (-1)
    sys.exit()


S = [["."] * W for i in range(H)]
for j in range(1,W,2):
    for i in range(H):
        S[i][j] = "#"

inst = ["D"] * (H-1) + ["R"] * 2 + ["U"] * (H-1) + ["R"] * 2
x = 0
y = 0
cnt = 0
while True:

    #print (x,y)
    if x >= H or y >= W or x < 0 or y < 0:
        break

    if (H-1-x) + (W-1-y) == X and x%2 == 0 and y%2==0:
        while y < W-1:
            S[x][y] = "."
            y += 1
        while x < H-1:
            S[x][y] = "."
            x += 1
        for i in S:
            print ("".join(i))
        sys.exit()

    S[x][y] = "."
    if inst[cnt % len(inst)] == "D":
        x += 1
    elif inst[cnt % len(inst)] == "R":
        y += 1
    elif inst[cnt % len(inst)] == "U":
        x -= 1
    else:
        y -= 1
    X -= 1
    cnt += 1

#print ("Second",file=sys.stderr)

X = ox
S = [["."] * W for i in range(H)]
inst = ["R"] * (W-1) + ["D"] * 2 + ["L"] * (W-1) + ["D"] * 2
x = 0
y = 0
cnt = 0
while True:

    if x >= H or y >= W or x < 0 or y < 0:
        break

    if (H-1-x) + (W-1-y) == X and x%2 == 0 and y%2==0:
        while x < H-1:
            S[x][y] = "."
            x += 1
        while y < W-1:
            S[x][y] = "."
            y += 1 
        for i in S:
            print ("".join(i))
        sys.exit()

    S[x][y] = "."
    if inst[cnt % len(inst)] == "D":
        x += 1
    elif inst[cnt % len(inst)] == "R":
        y += 1
    elif inst[cnt % len(inst)] == "U":
        x -= 1
    else:
        y -= 1
    X -= 1
    cnt += 1
        
print (-1)
0