結果

問題 No.1434 Make Maze
ユーザー yuusanlondonyuusanlondon
提出日時 2021-03-19 22:29:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,029 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 84,096 KB
最終ジャッジ日時 2024-04-29 17:35:18
合計ジャッジ時間 6,722 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 39 ms
51,840 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 40 ms
51,840 KB
testcase_05 AC 39 ms
52,224 KB
testcase_06 AC 39 ms
52,224 KB
testcase_07 AC 39 ms
51,712 KB
testcase_08 WA -
testcase_09 AC 39 ms
51,840 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 40 ms
51,584 KB
testcase_21 AC 40 ms
51,712 KB
testcase_22 AC 39 ms
51,840 KB
testcase_23 AC 40 ms
51,584 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

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=(m*n-1-r-x)//4
if m<n:
  count=0
  for i in range(1,n,2):
    if count%2:
      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):
        if stock:
          ans[i][j+1]='#'
          stock-=1
        else:
          ans[i][j-1]='#'
    count+=1
else:
  count=0
  for i in range(1,m,2):
    if count%2:
      for j in range(1,n,2):
        if stock:
          ans[j-1][i]='#'
          stock-=1
        else:
          ans[j+1][i]='#'
    else:
      for j in range(n-2,0,-2):
        if stock:
          ans[j+1][i]='#'
          stock-=1
        else:
          ans[j-1][i]='#'
    count+=1
for i in range(n):
  print(''.join(ans[i]))
0