結果

問題 No.1619 Coccinellidae
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-07-22 22:06:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 867 bytes
コンパイル時間 1,244 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 91,220 KB
最終ジャッジ日時 2023-09-24 17:08:03
合計ジャッジ時間 5,776 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,228 KB
testcase_01 AC 101 ms
87,080 KB
testcase_02 WA -
testcase_03 AC 73 ms
71,160 KB
testcase_04 AC 97 ms
90,580 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 87 ms
84,360 KB
testcase_08 WA -
testcase_09 AC 71 ms
71,280 KB
testcase_10 AC 86 ms
82,168 KB
testcase_11 WA -
testcase_12 AC 71 ms
71,248 KB
testcase_13 AC 95 ms
90,912 KB
testcase_14 WA -
testcase_15 AC 72 ms
71,244 KB
testcase_16 AC 71 ms
71,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

Mを適当に分解する
後は転倒数Kの構築

大きい方から決めていけばよい

"""

import sys
from sys import stdin

N,M,K = map(int,stdin.readline().split())

if N == 1:
    print (M)
    sys.exit()

lis = [0]

while len(lis) != N-1:

    lis.append(lis[-1] + 1)
    M -= lis[-1]

lis.append(M)

#print (lis,file=sys.stderr)

ans = []

for i in range(N):

    if K == 0:
        ans += lis
        break

    elif K >= N-1-i:
        K -= N-1-i
        ans.append(lis[-1])
        del lis[-1]

    else:

        tmp = lis[-1]
        del lis[-1]

        lis.reverse()
        while K > 0:
            ans.append(lis[-1])
            K -= 1
            del lis[-1]

        ans.append(tmp)

        while len(lis) > 0:
            ans.append(lis[-1])
            K -= 1
            del lis[-1]
        break

print ("\n".join(map(str,ans)))
0