結果

問題 No.115 遠足のおやつ
ユーザー Zu_rinZu_rin
提出日時 2020-09-11 13:05:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 903 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 74,812 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 19:06:49
合計ジャッジ時間 1,904 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 WA -
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 1 ms
4,384 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int NG(int num, int lim, int k) {
	if (lim < k * (k + 1) / 2)
		return 1;
	if (k * (2 * num - k + 1) / 2 < lim)
		return 1;
	return 0;
}

int main(void) {
	int num, i, lim, k, sum;
	cin >> num >> lim >> k;
	vector<int> ans(k);
	sum = (1 + k) * k / 2;
	rep(i, k)
		ans[i] = i + 1;
	i = k - 1;
	while (i >= 0 && sum < lim) {
		int a = min(num - (k - i - 1), ans[i] + lim - sum);
		sum += a - ans[i];
		ans[i] = a;
		i--;
	}
	if (sum != lim)
		printf("-1\n");
	else {
		rep(i, k)
			cout << ans[i] << " ";
	}
	printf("\n");
	return 0;
}
0