結果
問題 |
No.1434 Make Maze
|
ユーザー |
👑 ![]() |
提出日時 | 2021-03-19 22:24:08 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,640 bytes |
コンパイル時間 | 457 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 84,024 KB |
最終ジャッジ日時 | 2024-11-18 23:10:45 |
合計ジャッジ時間 | 7,243 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 WA * 2 RE * 5 |
ソースコード
""" """ 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)