結果
問題 | No.1434 Make Maze |
ユーザー | tyawanmusi |
提出日時 | 2021-01-10 15:01:44 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,489 bytes |
コンパイル時間 | 126 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 18,816 KB |
最終ジャッジ日時 | 2024-11-21 06:28:02 |
合計ジャッジ時間 | 5,225 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
11,008 KB |
testcase_01 | AC | 30 ms
11,136 KB |
testcase_02 | AC | 63 ms
18,816 KB |
testcase_03 | AC | 66 ms
18,816 KB |
testcase_04 | AC | 30 ms
11,008 KB |
testcase_05 | AC | 30 ms
11,136 KB |
testcase_06 | AC | 30 ms
11,008 KB |
testcase_07 | AC | 30 ms
11,008 KB |
testcase_08 | AC | 30 ms
11,008 KB |
testcase_09 | AC | 31 ms
11,008 KB |
testcase_10 | AC | 28 ms
11,008 KB |
testcase_11 | WA | - |
testcase_12 | AC | 32 ms
11,264 KB |
testcase_13 | AC | 31 ms
11,008 KB |
testcase_14 | AC | 32 ms
11,264 KB |
testcase_15 | AC | 40 ms
12,928 KB |
testcase_16 | AC | 33 ms
11,520 KB |
testcase_17 | AC | 30 ms
11,136 KB |
testcase_18 | AC | 34 ms
11,776 KB |
testcase_19 | AC | 48 ms
14,976 KB |
testcase_20 | RE | - |
testcase_21 | AC | 31 ms
11,008 KB |
testcase_22 | AC | 31 ms
11,008 KB |
testcase_23 | AC | 30 ms
11,008 KB |
testcase_24 | AC | 43 ms
13,824 KB |
testcase_25 | AC | 53 ms
16,000 KB |
testcase_26 | AC | 32 ms
11,392 KB |
testcase_27 | WA | - |
testcase_28 | AC | 32 ms
11,392 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 35 ms
11,776 KB |
ソースコード
def solve1(h, w, x): if (x-(h-1)-(w-1))%4 != 0: return ["-1"] if not (h-1)+(w-1) <= x <= ((h//2+1)*(w//2+1)-1)*2: return ["-1"] ans = [["#"]*w for i in range(h)] for i in range(0, h, 2): ans[i] = ["."]*w for i in range(1, h, 4): ans[i][w-1] = "." x -= (h-1)+(w-1) for i in range(3, h, 4): y = min(x//2, w-1) ans[i][(w-1)-y] = "." x -= y*2 return ans def solve2(h, w, x): if (x-(h-1)-(w-1))%4 != 0: return ["-1"] if not (h-1)+(w-1) <= x <= ((h//2+1)*(w//2+1)-2)*2: return ["-1"] ans = [["#"]*w for i in range(h)] if (h-3)+(2*(w//2+1)-2)*2 <= x: ans[0][0] = ans[0][w-1] ="." for j in range(2, w-4, 4): ans[0][j] = ans[0][j+1] = ans[0][j+2] = "." for j in range(0, w, 2): ans[1][j] = "." for j in range(0, w+1, 4): ans[2][j] = ans[2][j+1] = ans[2][j+2] = "." x -= (h-3)+(2*(w//2+1)-2)*2 else: ans[0] = ["."]*w ans[1][w-1] = "." ans[2] = ["."]*w x -= (h-1)+(w-1) for i in range(4, h, 2): ans[i] = ["."]*w for i in range(3, h, 4): ans[i][w-1] = "." for i in range(5, h, 4): y = min(x//2, w-1) ans[i][(w-1)-y] = "." x -= y*2 return ans h, w, x = map(int, input().split()) if h%4 == 3: if w%4 == 3: ans = solve2(h, w, x) for i in ans: print("".join(i)) else: ans = solve1(w, h, x) for i in range(w): print("".join([ans[i][j] for j in range(h)])) else: ans = solve1(h, w, x) for i in ans: print("".join(i))