結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー yumekawayuiyumekawayui
提出日時 2023-12-02 15:53:51
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,439 bytes
コンパイル時間 4,094 ms
コンパイル使用メモリ 186,352 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 15:53:57
合計ジャッジ時間 4,669 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/extc++.h>
using namespace std;
using ld = long double; 
const vector<int> dx = {0, 0, 1, -1};
const vector<int> dy = {1, -1, 0, 0};
#define vec vector
#define int long long
#define double long double
//cout<<setprecision(10)<<fixed<<..
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repp(i, x, n) for (int i = x; i < (int)(n); i++)
#define pii pair<int,int>
#define pq priority_queue
#define all(V) begin(V),end(V)
#define printpair(p) cout<<p.first<<" "<<p.second<<"\n"
#define tple tuple<int,int,int>
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
#define mend(a,b) G[a].push_back(b)

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;cin>>t;
    rep(q,t){
        int n,x;cin>>n>>x;
        if(n*(n+1)/2>x){
            cout<<-1<<"\n";continue;
        }
        vec<int> A(n);
        iota(all(A),1);
        int k=x-(n+1)*n/2;
        int cur=(k+n-1)/n;
        for(int i=n-1;i>=0;i--){
            if(k-cur<0){
                cout<<A[i]+k<<" ";
                k=0;
                continue;
            }
            cout<<A[i]+cur<<" ";
            k-=cur;
        }
        cout<<"\n";
    }

}
0