結果
| 問題 |
No.2560 A_1 < A_2 < ... < A_N
|
| コンテスト | |
| ユーザー |
toshiconner
|
| 提出日時 | 2023-12-02 14:55:05 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 146 ms / 2,000 ms |
| コード長 | 780 bytes |
| コンパイル時間 | 1,120 ms |
| コンパイル使用メモリ | 99,448 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-26 17:41:56 |
| 合計ジャッジ時間 | 3,103 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
#include<iostream>
#include<vector>
#include<ranges>
using namespace std;
using ll = long long;
int main() {
int T; cin >> T;
while(T--) {
int N; ll X; cin >> N >> X;
vector<ll> ans {0};
auto res = X;
auto success = true;
for(int i = 1; i <= (N - 1); ++i) {
if (res < i) {
success = false;
break;
}
ans.push_back(i);
res -= i;
}
if (res <= ans.back()) {
success = false;
}
ans.push_back(res);
if (success) {
for(int i = 1; i <= N; ++i) {
cout << ans[i] << " ";
}
cout << endl;
} else {
cout << -1 << endl;
}
}
}
toshiconner