結果

問題 No.2567 A_1 > A_2 > ... > A_N
コンテスト
ユーザー may17
提出日時 2023-12-02 16:45:49
言語 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  
実行時間 74 ms / 2,000 ms
コード長 642 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,210 ms
コンパイル使用メモリ 210,432 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-07-03 03:48:52
合計ジャッジ時間 2,949 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
const ll mod = 1000000007;
//const ll mod = 998244353;
ll t, n[100009], x[100009];
int main() {
	cin >> t;
	for (int i = 1; i <= t; i++)cin >> n[i] >> x[i];
	for (int i = 1; i <= t; i++) {
		if (((n[i] * (n[i] + 1)) / 2) > x[i]) {
			cout << "-1" << endl;
			continue;
		}
		ll res = x[i] - (n[i] * (n[i] + 1)) / 2;
		ll mo = res % n[i];
		ll div = res / n[i];
		ll cnt = 0;
		for (int j = n[i]; j >= 1; j--) {
			cnt++;
			ll ans = j;
			if (cnt <= mo)ans++;
			ans += div;
			cout << ans << " ";
		}
		cout << endl;
	}
}
0