結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2024-02-01 20:56:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,022 bytes
コンパイル時間 6,189 ms
コンパイル使用メモリ 81,248 KB
実行使用メモリ 75,336 KB
最終ジャッジ日時 2024-02-01 20:56:42
合計ジャッジ時間 20,723 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import java.io.PrintWriter;
import java.util.*;

public class Main {

    public static void vectorPrint(Vector lis){

        PrintWriter out = new PrintWriter(System.out);
        for (int i=0 ; i<lis.size() ; i++){
            System.out.print(lis.get(i));
            if ( i != lis.size()-1){
                out.print(' ');
            }else{
                out.print('\n');
            }
        }
        out.flush();
    }

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        int TT = sc.nextInt();

        for (int lp=0; lp<TT ; lp++){
            long N = sc.nextLong();
            long X = sc.nextLong();
            
            Vector lis = new Vector();
            for (long i=0; i<N-1 ; i++){
                lis.addElement(i+1);
                X -= i+1;
            }
            if (X >= N){
                lis.addElement(X);
                vectorPrint(lis);
            }else{
                System.out.println("-1");
            }
        }
    }
}
0