結果

問題 No.115 遠足のおやつ
コンテスト
ユーザー roiti46
提出日時 2015-02-10 01:08:54
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 438 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 267 ms
コンパイル使用メモリ 77,588 KB
最終ジャッジ日時 2025-12-03 13:43:51
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 8 WA * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N,D,K = map(int,raw_input().split())
s = []
for i in xrange(1,N+1):
    if sum(s)+i == D or sum(s)+i < D and D-(sum(s)+i) > i:
        s.append(i)
while len(s) > K:
    for i in range(1,len(s))[::-1]:
        if s[i]+s[i-1] <= N and s[i]+s[i-1] not in s:
            s = s[:i-1]+[s[i-1]+s[i]]+s[i+1:]
            s = sorted(s)
            break
    else:
        print s
        print -1
        break
else:
    print " ".join(map(str,s))
0