結果

問題 No.115 遠足のおやつ
ユーザー kohei2019
提出日時 2021-06-04 23:06:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 318 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-11-20 06:28:57
合計ジャッジ時間 3,482 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D,K = map(int,input().split())
if K*(K+1)//2 > D:
    print(-1)
    exit()
if K > N:
    print(-1)
    exit()

val = D-K*(K+1)//2
ans = [i+1 for i in range(K)]
for i in range(K-1,-1,-1):
    add = min(val,N-(-i+K-1)-ans[i])
    val -= add
    ans[i] += add

if val > 0:
    print(-1)
    exit()
else:
    print(*ans)
0