結果
問題 |
No.2567 A_1 > A_2 > ... > A_N
|
ユーザー |
![]() |
提出日時 | 2023-12-09 00:22:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 114 ms / 2,000 ms |
コード長 | 531 bytes |
コンパイル時間 | 1,856 ms |
コンパイル使用メモリ | 191,880 KB |
最終ジャッジ日時 | 2025-02-18 09:42:57 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve(){ ll N, X, Y, Z; cin >> N >> X; if (N*(N+1)/2 > X){ cout << -1 << endl; return; } Y = (X-N*(N+1)/2)/N; Z = X - N*(N+1)/2 - N * Y; for (int i=N; i>=1; i--){ cout << Y+i+(Z > 0) << " "; if (Z) Z--; } cout << endl; } int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int T; cin >> T; while(T){ T--; solve(); } return 0; }