結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー viral8viral8
提出日時 2023-12-02 15:57:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 375 ms / 2,000 ms
コード長 752 bytes
コンパイル時間 2,342 ms
コンパイル使用メモリ 77,704 KB
実行使用メモリ 61,568 KB
最終ジャッジ日時 2023-12-02 15:57:55
合計ジャッジ時間 6,930 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
54,104 KB
testcase_01 AC 214 ms
59,932 KB
testcase_02 AC 220 ms
61,188 KB
testcase_03 AC 188 ms
59,692 KB
testcase_04 AC 231 ms
57,824 KB
testcase_05 AC 248 ms
61,096 KB
testcase_06 AC 337 ms
61,568 KB
testcase_07 AC 337 ms
61,524 KB
testcase_08 AC 375 ms
61,120 KB
testcase_09 AC 356 ms
61,500 KB
testcase_10 AC 344 ms
61,368 KB
testcase_11 AC 55 ms
54,132 KB
testcase_12 AC 63 ms
54,496 KB
testcase_13 AC 52 ms
54,108 KB
testcase_14 AC 52 ms
54,120 KB
testcase_15 AC 62 ms
54,256 KB
testcase_16 AC 59 ms
54,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
class Main{
	private static final BufferedReader br =
		new BufferedReader(new InputStreamReader(System.in));
	private static final PrintWriter out =
		new PrintWriter(System.out);
	public static void main(String[] args)throws IOException{

		int T = Integer.parseInt(br.readLine());
		while(T-->0){
			String[] str = br.readLine().split(" ");
			long N = Long.parseLong(str[0]);
			long X = Long.parseLong(str[1]);
			if(X<N*(N+1)/2)
				out.println(-1);
			else{
				long sub = X-N*(N+1)/2;
				long index = sub%N;
				out.print(N+sub/N+(0<index?1:0));
				for(int i=1;i<N;i++){
					out.print(" ");
					out.print((N-i)+sub/N+(i<index?1:0));
				}
				out.println();
			}
		}

		br.close();
		out.close();
	}
}
0