結果
| 問題 | 
                            No.115 遠足のおやつ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             rocoder
                         | 
                    
| 提出日時 | 2017-07-30 11:36:08 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 812 bytes | 
| コンパイル時間 | 93 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-10-10 22:30:37 | 
| 合計ジャッジ時間 | 2,412 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 WA * 14 | 
ソースコード
#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:
            if D>N:
                print (-1)
            else:
                R.append(D)
            K-=1
        else:
            M=N+N-K+2
            M*=K-1
            M//=2
            F=D-i-M
            if F>=0:
                if i==1:
                    print (-1)
                    K=0
                else:
                    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)
            
            
            
        
            
rocoder