結果
問題 | No.1434 Make Maze |
ユーザー | convexineq |
提出日時 | 2021-03-19 23:30:57 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,602 bytes |
コンパイル時間 | 346 ms |
コンパイル使用メモリ | 82,300 KB |
実行使用メモリ | 84,160 KB |
最終ジャッジ日時 | 2024-11-19 02:00:18 |
合計ジャッジ時間 | 6,130 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
52,824 KB |
testcase_01 | AC | 39 ms
52,928 KB |
testcase_02 | AC | 94 ms
84,012 KB |
testcase_03 | AC | 95 ms
84,160 KB |
testcase_04 | AC | 40 ms
52,868 KB |
testcase_05 | AC | 41 ms
52,556 KB |
testcase_06 | AC | 41 ms
52,592 KB |
testcase_07 | AC | 40 ms
53,436 KB |
testcase_08 | AC | 42 ms
53,100 KB |
testcase_09 | AC | 41 ms
53,840 KB |
testcase_10 | AC | 40 ms
53,244 KB |
testcase_11 | AC | 41 ms
53,700 KB |
testcase_12 | WA | - |
testcase_13 | AC | 42 ms
53,132 KB |
testcase_14 | AC | 55 ms
66,052 KB |
testcase_15 | AC | 68 ms
78,164 KB |
testcase_16 | AC | 56 ms
67,404 KB |
testcase_17 | AC | 55 ms
66,100 KB |
testcase_18 | AC | 58 ms
69,972 KB |
testcase_19 | AC | 78 ms
80,452 KB |
testcase_20 | AC | 40 ms
53,312 KB |
testcase_21 | AC | 41 ms
54,676 KB |
testcase_22 | AC | 39 ms
53,104 KB |
testcase_23 | AC | 40 ms
53,604 KB |
testcase_24 | AC | 71 ms
79,080 KB |
testcase_25 | AC | 81 ms
81,416 KB |
testcase_26 | AC | 58 ms
67,028 KB |
testcase_27 | AC | 76 ms
78,692 KB |
testcase_28 | AC | 54 ms
66,684 KB |
testcase_29 | AC | 47 ms
61,992 KB |
testcase_30 | AC | 59 ms
69,780 KB |
testcase_31 | AC | 63 ms
72,116 KB |
ソースコード
h,w,x = map(int,input().split()) a,b = h//2+1,w//2+1 L = a+b-2 if a%2==0 and b%2==0: R = a*b-2 else: R = a*b-1 if x%2: print(-1) exit() x //= 2 #print(a,b,L,x,R) if x%2 != L%2 or not (L <= x <= R): print(-1) exit() ans = [[0]*w for _ in range(h)] def dist(i,j): return a+b-i-j-2 res = [] p,q,cnt = 0,0,0 if a%2: for i in range(h): for j in range(w): if i%2==0: ans[i][j] = 1 while cnt + dist(p,q) != x: if p%2==0: if q != b-1: q += 1 else: ans[2*p+1][2*q] = 1 p += 1 else: if q: q -= 1 else: ans[2*p+1][2*q] = 1 p += 1 cnt += 1 while p != a-1: ans[2*p+1][2*q] = 1 p += 1 elif b%2: for i in range(h): for j in range(w): if j%2==0: ans[i][j] = 1 while cnt + dist(p,q) != x: if q%2==0: if p != a-1: p += 1 else: ans[2*p][2*q+1] = 1 q += 1 else: if p: p -= 1 else: ans[2*p][2*q+1] = 1 q += 1 cnt += 1 while q != b-1: ans[2*p][2*q+1] = 1 q += 1 else:#ぐぐ while cnt + dist(p,q) != x: if p%2==0: if q != b-1: q += 1 else: ans[2*p+1][2*q] = 1 p += 1 else: if q: q -= 1 else: ans[2*p+1][2*q] = 1 p += 1 cnt += 1 if p == a-2 and q == 0: break #print(p,q) if p != a-2 or q != 0: for i in range(h): for j in range(w): if i%2==0: ans[i][j] = 1 while p != a-1: ans[2*p+1][2*q] = 1 p += 1 else: for i in range(h-3): for j in range(w): if i%2==0: ans[i][j] = 1 for i in range(h-3,h): for j in range(w): if j%2==0: ans[i][j] = 1 while cnt + dist(p,q) != x: if q%2==0: if p != a-1: p += 1 else: ans[2*p][2*q+1] = 1 q += 1 else: if p: p -= 1 else: ans[2*p][2*q+1] = 1 q += 1 cnt += 1 while q != b-1: ans[2*p][2*q+1] = 1 q += 1 s = "#." for ai in ans: print("".join(map(lambda i:s[i],ai)))