結果

問題 No.115 遠足のおやつ
ユーザー roiti46roiti46
提出日時 2015-02-10 01:09:13
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 6,704 KB
実行使用メモリ 6,100 KB
最終ジャッジ日時 2023-09-05 21:33:45
合計ジャッジ時間 1,942 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 11 ms
5,932 KB
testcase_06 WA -
testcase_07 AC 12 ms
5,880 KB
testcase_08 AC 11 ms
5,876 KB
testcase_09 AC 11 ms
5,920 KB
testcase_10 AC 11 ms
5,980 KB
testcase_11 AC 11 ms
5,864 KB
testcase_12 AC 11 ms
5,860 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 11 ms
5,844 KB
testcase_18 WA -
testcase_19 AC 11 ms
6,048 KB
testcase_20 AC 12 ms
5,992 KB
testcase_21 AC 11 ms
5,932 KB
testcase_22 WA -
testcase_23 AC 11 ms
6,048 KB
testcase_24 WA -
testcase_25 AC 12 ms
5,844 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 11 ms
5,864 KB
testcase_32 WA -
testcase_33 AC 11 ms
5,840 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 12 ms
5,924 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 11 ms
6,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 -1
        break
else:
    print " ".join(map(str,s))
0