結果

問題 No.883 ぬりえ
ユーザー kohei2019kohei2019
提出日時 2022-05-06 11:51:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 87,396 KB
実行使用メモリ 89,136 KB
最終ジャッジ日時 2023-09-19 00:56:44
合計ジャッジ時間 4,100 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,884 KB
testcase_01 AC 76 ms
71,760 KB
testcase_02 AC 77 ms
71,496 KB
testcase_03 AC 76 ms
71,864 KB
testcase_04 AC 75 ms
71,820 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 78 ms
71,896 KB
testcase_08 AC 77 ms
71,624 KB
testcase_09 AC 79 ms
71,852 KB
testcase_10 AC 80 ms
72,048 KB
testcase_11 AC 79 ms
71,620 KB
testcase_12 AC 78 ms
71,644 KB
testcase_13 AC 78 ms
71,776 KB
testcase_14 WA -
testcase_15 AC 194 ms
89,136 KB
testcase_16 AC 130 ms
82,560 KB
testcase_17 AC 116 ms
80,560 KB
testcase_18 AC 95 ms
76,896 KB
testcase_19 WA -
testcase_20 AC 78 ms
71,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
import math
N,K = map(int,input().split())
M = max(-(-N//K),math.ceil(N**(1/2)))
HW = [['.']*M for _ in range(M)]

h = []
for i in range(M):
    h.append((0,i))
heapq.heapify(h)
cnt = 0

for i in range(M):
    cnt0 = 0
    while cnt0 != K:
        a,b = heapq.heappop(h)
        HW[i][b] = '#'
        heapq.heappush(h, (a+1,b))
        cnt0 += 1
        cnt += 1
        if cnt == N:
            break
    if cnt == N:
        break
print(M)
for i in range(M):
    print(*HW[i],sep='')
            
0