結果
| 問題 | No.2567 A_1 > A_2 > ... > A_N |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-04 20:43:20 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 2,000 ms |
| コード長 | 794 bytes |
| 記録 | |
| コンパイル時間 | 389 ms |
| コンパイル使用メモリ | 97,184 KB |
| 実行使用メモリ | 9,220 KB |
| 最終ジャッジ日時 | 2026-07-05 02:39:49 |
| 合計ジャッジ時間 | 2,681 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 16 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
int T, i, N, j;
long long X, sum;
vector<long long> ans;
cin >> T;
for (i = 0; i != T; ++i)
{
cin >> N >> X;
ans.clear();
sum = N * static_cast<long long>(N + 1) / 2;
if (sum > X)
{
cout << "-1\n";
continue;
}
for (j = 0; j != N; ++j)
ans.push_back(j + 1 + (X - sum) / N);
reverse(ans.begin(), ans.end());
for (j = 0; j != (X - sum) % N; ++j)
++ans[j];
cout << ans[0];
for (j = 1; j != ans.size(); ++j)
cout << ' ' << ans[j];
cout << '\n';
}
return 0;
}