結果

問題 No.1434 Make Maze
ユーザー yuusanlondonyuusanlondon
提出日時 2021-03-19 22:57:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 84,960 KB
最終ジャッジ日時 2023-08-16 09:25:24
合計ジャッジ時間 8,479 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,444 KB
testcase_01 AC 71 ms
71,332 KB
testcase_02 AC 137 ms
84,812 KB
testcase_03 AC 137 ms
84,960 KB
testcase_04 AC 72 ms
71,232 KB
testcase_05 AC 72 ms
71,316 KB
testcase_06 AC 72 ms
71,324 KB
testcase_07 AC 73 ms
71,212 KB
testcase_08 AC 72 ms
71,048 KB
testcase_09 AC 72 ms
71,484 KB
testcase_10 AC 71 ms
71,580 KB
testcase_11 AC 73 ms
71,284 KB
testcase_12 AC 85 ms
76,252 KB
testcase_13 AC 73 ms
71,252 KB
testcase_14 AC 86 ms
76,188 KB
testcase_15 AC 100 ms
78,772 KB
testcase_16 AC 90 ms
76,332 KB
testcase_17 AC 86 ms
76,512 KB
testcase_18 AC 90 ms
76,612 KB
testcase_19 AC 115 ms
81,804 KB
testcase_20 AC 72 ms
71,524 KB
testcase_21 AC 72 ms
71,432 KB
testcase_22 AC 74 ms
71,456 KB
testcase_23 AC 71 ms
71,336 KB
testcase_24 AC 101 ms
78,672 KB
testcase_25 AC 117 ms
81,792 KB
testcase_26 AC 89 ms
76,684 KB
testcase_27 AC 108 ms
78,964 KB
testcase_28 AC 88 ms
76,424 KB
testcase_29 AC 81 ms
76,084 KB
testcase_30 AC 91 ms
76,656 KB
testcase_31 AC 95 ms
76,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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]))
0