結果
| 問題 | No.2560 A_1 < A_2 < ... < A_N | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-02 15:31:51 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 145 ms / 2,000 ms | 
| コード長 | 1,220 bytes | 
| コンパイル時間 | 636 ms | 
| コンパイル使用メモリ | 72,656 KB | 
| 最終ジャッジ日時 | 2025-02-18 04:41:19 | 
| ジャッジサーバーID (参考情報) | judge4 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 15 | 
ソースコード
/**
 * @file 2560.cpp
 * @brief yukicoder No.2560 A_1 < A_2 < ... < A_N
 * @author Keitaro Naruse
 * @date 2023-12-02
 * @copyright MIT License
 * @details https://yukicoder.me/problems/no/2560
 * */
// # Solution
#include <iostream>
#include <vector>
template < class T >
std::ostream& operator<<( std::ostream& os, const std::vector< T >& v ) {
    for( auto it = v.begin( ); it != v.end( ); it++ ) {
        os << *it << ( it == --v.end( ) ? "" : " " );
    }
    return os;
}
int main( ) {
    //  Read T = [ 1, 10^5 ]
    int T;
    std::cin >> T;
    //  Multiple queries
    for( int t = 0; t < T; t++ ) {
        //  Read N = [ 1, 2*10^5 ], X = [ 1, 10^18 ]
        long long N;
        long long X;
        std::cin >> N >> X;
        //  Main::Preprocess
        std::vector< long long > A( N );
        for( int i = 0; i < N; i++ ) {
            A.at( i ) = ( long long ) ( i + 1 );
        }
        //  Main::Find a solution
        A.at( N - 1 ) += X - N * ( N + 1LL ) / 2LL;
        //  Main::Output a solution
        if( A.at( N - 1 ) >= N ) {
            std::cout << A << std::endl;
        } else {
            std::cout << -1 << std::endl;
        }
    }
    
    //  Finalize
    return 0;
}
            
            
            
        