結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー eve__fuyuki
提出日時 2023-12-11 13:17:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 1,914 ms
コンパイル使用メモリ 194,132 KB
最終ジャッジ日時 2025-02-18 10:22:37
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

void solve() {
    long long n, x;
    cin >> n >> x;
    if (x < n * (n + 1) / 2) {
        cout << -1 << endl;
        return;
    }
    vector<long long> ans(n);
    for (long long i = n - 1; i >= 0; i--) {
        ans[i] = (x - i * (i + 1) / 2 + i) / (i + 1);
        x -= ans[i];
    }
    for (int i = 0; i < n; i++) {
        cout << ans[i] << (i + 1 == n ? "\n" : " ");
    }
}
int main() {
    fast_io();
    int t;
    cin >> t;
    for (; t--;) {
        solve();
    }
}
0