結果

問題 No.2567 A_1 > A_2 > ... > A_N
コンテスト
ユーザー takumi152
提出日時 2023-12-02 15:58:42
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 894 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 567 ms
コンパイル使用メモリ 105,300 KB
実行使用メモリ 11,964 KB
最終ジャッジ日時 2026-07-03 03:35:43
合計ジャッジ時間 2,225 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 998244353;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int t;
  cin >> t;
  vector<ll> n(t), x(t);
  for (int i = 0; i < t; i++) {
    cin >> n[i] >> x[i];
  }

  vector<vector<ll>> ans(t);
  for (int i = 0; i < t; i++) {
    ll total_min = n[i] * (n[i] + 1LL) / 2LL;
    if (x[i] < total_min) {
      ans[i].push_back(-1);
      continue;
    }

    ll div = (x[i] - total_min) / n[i];
    ll rem = (x[i] - total_min) % n[i];
    for (int j = n[i]; j > 0; j--) {
      ans[i].push_back(j + div + (n[i] - j < rem ? 1 : 0));
    }
  }

  for (auto &x: ans) {
    for (auto &y: x) cout << y << " ";
    cout << endl;
  }

  return 0;
}
0