結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー ku_senjanku_senjan
提出日時 2023-12-02 15:58:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,500 bytes
コンパイル時間 5,802 ms
コンパイル使用メモリ 300,672 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 15:58:42
合計ジャッジ時間 7,873 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 148 ms
6,676 KB
testcase_07 AC 146 ms
6,676 KB
testcase_08 AC 152 ms
6,676 KB
testcase_09 AC 146 ms
6,676 KB
testcase_10 AC 167 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 3 ms
6,676 KB
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifdef SENJAN
#include <ku/debug.hpp>
#else
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define debug(...)
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using graph=vector<vector<int>>;
template<class T> using wgraph=vector<vector<pair<int,T>>>;
template<class T> using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
constexpr int INF32=INT_MAX/2;
constexpr ll INF64=1LL<<60;
constexpr ld PI=3.14159265358979323846;
constexpr int dx[]={0,0,-1,1,-1,-1,1,1},dy[]={-1,1,0,0,-1,1,-1,1};
#define rep(i,s,n) for(ll i=(ll)(s);i<(ll)(n);i++)
#define rrep(i,s,n) for(ll i=(ll)(s);i>=(ll)(n);i--)
template<class T> inline bool chmax(T &a,T b){return a<b?a=b,true:false;}
template<class T> inline bool chmin(T &a,T b){return a>b?a=b,true:false;}
void _main();
int main(){cin.tie(0)->sync_with_stdio(0);cout<<fixed<<setprecision(16);_main();}

void solve(){
	ll N, X; cin >> N >> X;

	vector<ll> ans(N);
	rrep(i,N-1,0){
		auto check = [&](ll a) -> bool{
			return (i+1)*(2*a+i) <= 2*X;
		};

		ll ok = 0, ng = INF64;
		while(abs(ok-ng)>1){
			ll mid = (ok+ng)/2;
			if(check(mid)) ok = mid;
			else ng = mid;
		}
		if(ok==0){
			cout << -1 << endl;
			return;
		}
		ans[i] = ok;
		X -= ans[i];
	}

	rep(i,0,N){
		if(i) cout << ' ';
		cout << ans[i];
	}
	cout << endl;
}

void _main(){
	int T; cin >> T;
	while(T--) solve();
}
0