結果
| 問題 |
No.115 遠足のおやつ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-06 12:35:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 426 bytes |
| コンパイル時間 | 2,022 ms |
| コンパイル使用メモリ | 192,556 KB |
| 最終ジャッジ日時 | 2025-01-07 10:47:38 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, d, k;
cin>>n>>d>>k;
if (n < k || d < k*(k+1)/2 || k*(n+n-k+1)/2 < d) {
puts("-1");
return 0;
}
for (int i=1;i<=n&&k>0;i++) {
if (d-i < (k-1)*(i+1+i+k-1-1)/2 || (k-1)*(n-(k-1)+1+n)/2 < d-i) continue;
cout << i << ' ';
d -= i;
k--;
}
cout << endl;
return 0;
}