結果

問題 No.115 遠足のおやつ
ユーザー ngtkana
提出日時 2020-03-25 23:50:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 3,253 ms
コンパイル使用メモリ 191,060 KB
最終ジャッジ日時 2025-01-09 10:10:39
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 4 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using lint=long long;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint N,D,K;std::cin>>N>>D>>K;
    D-=K*(K+1)/2;
    if(D<0||N*(N-K)<D){
        std::cout<<-1<<'\n';
        return 0;
    }
    lint q=D/(N-K),r=D%(N-K);
    for(lint i=1;i<=K;i++){
        std::cout<<(1<i?" ":"")<<i+(i<=K-q-1?0:i==K-q?r:N-K);
    }
    std::cout<<'\n';
}
0