結果
| 問題 |
No.1434 Make Maze
|
| コンテスト | |
| ユーザー |
yuusanlondon
|
| 提出日時 | 2021-03-19 22:57:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 2,000 ms |
| コード長 | 803 bytes |
| コンパイル時間 | 330 ms |
| コンパイル使用メモリ | 82,296 KB |
| 実行使用メモリ | 83,696 KB |
| 最終ジャッジ日時 | 2024-11-24 21:39:31 |
| 合計ジャッジ時間 | 5,408 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
ソースコード
n,m,x=map(int,input().split())
r=((m-1)//2)*((n-1)//2)*2
if x>m*n-1-r or x<m+n-2 or (x-(m+n-2))%4!=0:
print(-1)
exit()
ans=[]
for i in range(n):
ans.append([])
for j in range(m):
if i%2 and j%2:
ans[-1].append('#')
else:
ans[-1].append('.')
stock=(x-(m+n-2))//4
count=0
for i in range(1,n,2):
if count%2==0:
if i==n-2 and stock:
count2=0
for j in range(1,m,2):
if stock and count2%2==0:
ans[i-1][j]='#'
stock-=1
else:
ans[i+1][j]='#'
count2+=1
else:
for j in range(1,m,2):
if stock:
ans[i][j-1]='#'
stock-=1
else:
ans[i][j+1]='#'
else:
for j in range(m-2,0,-2):
ans[i][j+1]='#'
count+=1
for i in range(n):
print(''.join(ans[i]))
yuusanlondon