結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー Pres1dent
提出日時 2023-12-02 14:41:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 948 ms
コンパイル使用メモリ 94,368 KB
最終ジャッジ日時 2025-02-18 03:47:03
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
using namespace std;

void solve() {
  long long n, x; cin >> n >> x;
  long long s = (n + 1) * n / 2;
  if (s > x) cout << -1 << endl;
  else {
    for (int i = 0; i < n - 1; i++) {
      cout << i + 1 << " ";
    }
    cout << x - s + n << endl;
  }
}

int main() {
  int t; cin >> t;
  while (t--) solve();
}

0