結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー t98slidert98slider
提出日時 2023-12-02 14:44:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 6,254 ms
コンパイル使用メモリ 203,440 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 14:44:12
合計ジャッジ時間 3,803 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 11 ms
6,676 KB
testcase_02 AC 13 ms
6,676 KB
testcase_03 AC 11 ms
6,676 KB
testcase_04 AC 13 ms
6,676 KB
testcase_05 AC 14 ms
6,676 KB
testcase_06 AC 26 ms
6,676 KB
testcase_07 AC 26 ms
6,676 KB
testcase_08 AC 25 ms
6,676 KB
testcase_09 AC 25 ms
6,676 KB
testcase_10 AC 26 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {
    if(vec.empty()) return os;
    os << vec[0];
    for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;
    return os;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while(T--){
        ll n, x;
        cin >> n >> x;
        if(n * (n + 1) / 2 <= x){
            vector<ll> ans(n);
            iota(ans.begin(), ans.end(), 1);
            ans.back() = x - n * (n - 1) / 2;
            cout << ans << '\n';
        }else{
            cout << -1 << '\n';
        }
    }
}
0