結果

問題 No.883 ぬりえ
ユーザー kohei2019kohei2019
提出日時 2022-05-06 11:46:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 88,744 KB
最終ジャッジ日時 2023-09-19 00:52:48
合計ジャッジ時間 5,013 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,172 KB
testcase_01 AC 80 ms
71,344 KB
testcase_02 AC 80 ms
71,124 KB
testcase_03 AC 80 ms
71,468 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 80 ms
71,436 KB
testcase_08 AC 79 ms
71,384 KB
testcase_09 AC 82 ms
71,124 KB
testcase_10 AC 79 ms
71,616 KB
testcase_11 AC 79 ms
71,500 KB
testcase_12 AC 80 ms
71,272 KB
testcase_13 AC 81 ms
71,276 KB
testcase_14 WA -
testcase_15 AC 201 ms
88,744 KB
testcase_16 AC 130 ms
81,788 KB
testcase_17 AC 124 ms
80,004 KB
testcase_18 AC 96 ms
76,096 KB
testcase_19 WA -
testcase_20 AC 80 ms
71,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

N,K = map(int,input().split())
M = -(-N//K)
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