結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー Feishi LiFeishi Li
提出日時 2023-12-02 15:11:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 579 bytes
コンパイル時間 3,245 ms
コンパイル使用メモリ 259,400 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2023-12-02 15:11:37
合計ジャッジ時間 4,632 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <bits/extc++.h>
using i64 = long long;
using i128 = __int128_t;
void solve()
{
    i64 n, x;
    std::cin >> n >> x;
    i64 check = (n - 1) * (n + 2) / 2;
    if (check >= x)
    {
        std::cout << "-1\n";
        return;
    }
    i64 S = n * (n - 1) / 2;
    i64 r = x - S;
    for (int i = 1; i <= n - 1; i++)
    {
        std::cout << i << ' ';
    }
    std::cout << r << '\n';
}
int main()
{
    std::cin.tie(nullptr)->sync_with_stdio(false);
    int t;
    std::cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
0