結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー GOTKAKO
提出日時 2023-12-02 15:40:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 1,732 ms
コンパイル使用メモリ 192,380 KB
最終ジャッジ日時 2025-02-18 04:50:05
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int test; cin >> test;
    while(test--){
        long long N,X; cin >> N >> X;
        long long minx = (N+1)*N/2;
        if(minx > X){cout << -1 << endl; continue;}

        long long more = X-minx,add = more/N;
        more %= N;
        for(int i=0; i<N; i++){
            if(i) cout << " ";
            if(i < more) cout << N-i+add+1;
            else cout << N-i+add;
        }
        cout << endl;
    }
}
0