結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー loop0919loop0919
提出日時 2023-11-27 23:49:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,492 ms / 2,000 ms
コード長 605 bytes
コンパイル時間 2,295 ms
コンパイル使用メモリ 75,912 KB
実行使用メモリ 73,648 KB
最終ジャッジ日時 2023-12-01 11:08:08
合計ジャッジ時間 17,909 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
58,196 KB
testcase_01 AC 755 ms
69,116 KB
testcase_02 AC 798 ms
68,300 KB
testcase_03 AC 719 ms
68,336 KB
testcase_04 AC 1,002 ms
69,348 KB
testcase_05 AC 929 ms
69,168 KB
testcase_06 AC 1,458 ms
73,648 KB
testcase_07 AC 1,485 ms
73,020 KB
testcase_08 AC 1,487 ms
73,600 KB
testcase_09 AC 1,492 ms
72,820 KB
testcase_10 AC 1,478 ms
72,992 KB
testcase_11 AC 188 ms
58,208 KB
testcase_12 AC 211 ms
58,056 KB
testcase_13 AC 191 ms
58,176 KB
testcase_14 AC 181 ms
58,196 KB
testcase_15 AC 221 ms
58,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int T = sc.nextInt();
        
        for (int i = 0; i < T; i++) {
            long N = sc.nextLong();
            long X = sc.nextLong();
            solve(N, X);
        }
    }
    
    static void solve(long N, long X) {
        if (X < N * (N+1) / 2) {
            System.out.println(-1);
            return;
        }
        
        for (int i = 1; i <= N-1; i++) System.out.print(i + " ");
        System.out.println(X - (N * (N-1) / 2));
    }
}
0