結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー tnakao0123tnakao0123
提出日時 2023-12-03 18:04:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 40,768 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-03 18:04:03
合計ジャッジ時間 2,349 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 32 ms
6,676 KB
testcase_07 AC 31 ms
6,676 KB
testcase_08 AC 32 ms
6,676 KB
testcase_09 AC 32 ms
6,676 KB
testcase_10 AC 32 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 1 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 #

/* -*- coding: utf-8 -*-
 *
 * 2560.cc:  No.2560 A_1 < A_2 < ... < A_N - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  int tn;
  scanf("%d", &tn);

  while (tn--) {
    int n;
    ll x;
    scanf("%d%lld", &n, &x);

    if ((ll)n * (n + 1) / 2 > x) { puts("-1"); continue; }

    for (int i = 1; i < n; i++) printf("%d ", i);
    printf("%lld\n", x - (ll)n * (n - 1) / 2);
  }
  return 0;
}
0