結果

問題 No.115 遠足のおやつ
ユーザー rocoder
提出日時 2017-07-30 11:22:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 647 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-10 22:30:28
合計ジャッジ時間 2,874 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

# your code goes here
#picnic
N,D,K=(int(i) for i in input().split())
S=1+K
S*=K
S//=2
if S>D:
    print(-1)
else:
    i=1
    R=[]
    while D>0 and K>0 and i<=N:
        if K==1:
            R.append(D)
            K-=1
        else:
            M=N+N-K+2
            M*=K-1
            M//=2
            F=D-i-M
            if F>=0:
                R.append(F+i)
                for j in range(K-1):
                    R.append(N-K+j+2)
                K-=K
            else:
                K-=1
                R.append(i)
                D-=i
                i+=1
    T=""
    for j in range (len(R)):
        T+=str(R[j])+" "
    print (T)
0