結果

問題 No.2339 Factorial Paths
ユーザー hir355hir355
提出日時 2023-06-02 22:41:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 108,472 KB
最終ジャッジ日時 2023-08-28 04:54:42
合計ジャッジ時間 10,924 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,608 KB
testcase_01 AC 71 ms
71,180 KB
testcase_02 WA -
testcase_03 AC 71 ms
71,496 KB
testcase_04 AC 74 ms
71,316 KB
testcase_05 AC 73 ms
71,548 KB
testcase_06 AC 73 ms
71,512 KB
testcase_07 AC 73 ms
71,480 KB
testcase_08 AC 81 ms
76,816 KB
testcase_09 AC 83 ms
77,088 KB
testcase_10 AC 89 ms
77,612 KB
testcase_11 AC 96 ms
79,028 KB
testcase_12 AC 99 ms
79,256 KB
testcase_13 AC 111 ms
81,644 KB
testcase_14 AC 137 ms
83,832 KB
testcase_15 AC 198 ms
91,100 KB
testcase_16 AC 276 ms
99,132 KB
testcase_17 AC 328 ms
105,452 KB
testcase_18 AC 338 ms
107,848 KB
testcase_19 AC 339 ms
107,696 KB
testcase_20 AC 371 ms
108,092 KB
testcase_21 AC 343 ms
108,472 KB
testcase_22 AC 348 ms
108,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
if n == 1:
    print('.')
    exit(0)
l = []
st = [n]
h, w = 1, 1
while st:
    p = st.pop()
    if p == 1:
        continue
    st.append(p // 2)
    st.append((p + 1) // 2)
    if h < w:
        l.append((p // 2, (p + 1) // 2))
        h += p // 2 + 1
        w += (p + 1) // 2 + 1
    else:
        l.append(((p + 1) // 2, p // 2))
        w += p // 2
        h += (p + 1) // 2
s = [['#'] * w for _ in range(h)]
p, q = 0, 0
for x, y in l:
    for j in range(p, p + x + 1):
        for k in range(q, q + y + 1):
            s[j][k] = '.'
    p += x
    q += y
print(h, w)
for row in s:
    print(*row, sep='')
0