結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー mn01137mn01137
提出日時 2023-12-03 05:07:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 3,614 bytes
コンパイル時間 2,417 ms
コンパイル使用メモリ 205,116 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-03 05:07:28
合計ジャッジ時間 4,699 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

const int INF = INT_MAX;
const long long LINF = 1e18;
const long long MOD1000000007 = 1000000007;
const long long MOD998244353 = 998244353;

using namespace std;

/*
    ∧_∧
 ( ´・ω・)
  //\ ̄ ̄旦\   @author mn01137
// ※ \___\
\\  ※  ※  ※ ヽ
  \ヽ-___--___ヽ
*/

/*---------------- typedef  ----------------------*/

typedef long long ll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

/*---------------- function  -------------------------*/

template <class T>
bool clamp(T x, T min, T max) { return (x >= min and x <= max); }
void YesNo(bool ok) { cout << (ok ? "Yes" : "No") << endl; }
template <class T>
void chmin(T &a, const T &b)
{
    if (b < a)
        a = b;
}
template <class T>
void chmax(T &a, const T &b)
{
    if (a < b)
        a = b;
}
template <class T>
T gcd(T a, T b)
{
    return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b)
{
    return a / gcd(a, b) * b;
}
/**
 * @brief arithmetic progression sum
 *
 * @tparam T
 * @param n number of terms
 * @param a1 first terms
 * @param d difference
 * @return T
 */
template <class T>
T apsum(T n, T a1, T d) { return (n * (2 * a1 + (n - 1) * d)) / 2; }
double euclid_distance(pair<double, double> a, pair<double, double> b) { return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second)); }
template <class T>
T euclid_distance2(pair<T, T> a, pair<T, T> b) { return (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second); }

/*---------------- debug  ---------------------*/

template <class T>
void print(vector<T> &a)
{
    for (auto nx : a)
        cout << nx << ' ';
    cout << endl;
}
template <class T>
void print(vector<vector<T>> &a)
{
    for (auto nv : a)
    {
        for (auto nx : nv)
            cout << nx << ' ';
        cout << endl;
    }
}
template <class T>
void print(set<T> &a)
{
    for (auto nx : a)
        cout << nx << ' ';
    cout << endl;
}
template <class T>
void print(multiset<T> &a)
{
    for (auto nx : a)
        cout << nx << ' ';
    cout << endl;
}

/*---------------- macro -------------------------*/

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, j, n) for (int i = j; i < (int)(n); i++)
#define revrep(i, n) for (int i = n; i >= 0; i--)
#define rrep(i, n) for (int i = 1; i <= (int)(n); i++)
#define rrep1(i, j, n) for (int i = j; i <= (int)(n); i++)
#define each(i, a) for (auto &&i : a)
#define bit(k) (1LL << (k))
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define SZ(a) int((a).size())

/*-------------- source code --------------------*/

// int dx[4] = {1, 0, -1, 0};
// int dy[4] = {0, 1, 0, -1};

void solve2()
{
}

void solve()
{
    int t;
    cin >> t;
    while (t--)
    {
        ll n, x;
        cin >> n >> x;
        vector<ll> ans;
        ll sum = 0;
        rrep(i, n - 1)
        {
            ans.push_back(i);
            sum += i;
        }
        if (x - sum >= n)
        {
            rep(i, ans.size())
            {
                cout << ans[i] << " ";
            }
            cout << x - sum << endl;
        }
        else
        {
            cout << -1 << endl;
        }
    }
}

int main()
{
    // cout << fixed << setprecision(10);
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    while (t--)
    {
        solve();
        // solve2();
    }

    return 0;
}
0