結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー takumi152takumi152
提出日時 2023-12-02 15:58:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 894 bytes
コンパイル時間 786 ms
コンパイル使用メモリ 88,488 KB
実行使用メモリ 9,088 KB
最終ジャッジ日時 2023-12-02 15:58:49
合計ジャッジ時間 3,243 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 17 ms
6,676 KB
testcase_02 AC 20 ms
6,676 KB
testcase_03 AC 18 ms
6,676 KB
testcase_04 AC 20 ms
6,676 KB
testcase_05 AC 22 ms
6,676 KB
testcase_06 AC 123 ms
9,088 KB
testcase_07 AC 124 ms
9,088 KB
testcase_08 AC 127 ms
9,088 KB
testcase_09 AC 123 ms
9,088 KB
testcase_10 AC 126 ms
9,088 KB
testcase_11 AC 3 ms
6,676 KB
testcase_12 AC 2 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
testcase_16 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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