結果
問題 |
No.2567 A_1 > A_2 > ... > A_N
|
ユーザー |
|
提出日時 | 2025-02-02 21:25:04 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 685 bytes |
コンパイル時間 | 4,445 ms |
コンパイル使用メモリ | 272,560 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-02-02 21:25:11 |
合計ジャッジ時間 | 6,929 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int T; cin >> T; rep(testcase, 0, T) { ll N, X; cin >> N >> X; ll sum = N*(N + 1) / 2; if (sum > X) { cout << -1 << '\n'; continue; } ll b = (X - sum) / N; int rest = (X - sum) % N; rep(i, 0, N) { cout << (N - i) + b + (i < rest ? 1 : 0) << (i == N - 1 ? '\n' : ' '); } } }