結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー 21kazu1321kazu13
提出日時 2023-12-04 15:55:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 1,514 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 85,984 KB
最終ジャッジ日時 2023-12-04 15:55:08
合計ジャッジ時間 4,425 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
65,796 KB
testcase_01 AC 100 ms
83,292 KB
testcase_02 AC 104 ms
85,300 KB
testcase_03 AC 99 ms
85,360 KB
testcase_04 AC 102 ms
85,708 KB
testcase_05 AC 108 ms
85,984 KB
testcase_06 AC 225 ms
79,276 KB
testcase_07 AC 228 ms
79,352 KB
testcase_08 AC 220 ms
79,344 KB
testcase_09 AC 233 ms
79,716 KB
testcase_10 AC 229 ms
79,276 KB
testcase_11 AC 58 ms
65,796 KB
testcase_12 AC 66 ms
70,992 KB
testcase_13 AC 59 ms
65,924 KB
testcase_14 AC 62 ms
65,924 KB
testcase_15 AC 64 ms
68,884 KB
testcase_16 AC 60 ms
65,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys
from bisect import bisect_left, bisect_right, insort_left, insort_right  # type: ignore
from collections import Counter, defaultdict, deque  # type: ignore
from math import gcd, sqrt, ceil, factorial  # type: ignore
from heapq import heapify, heappop, heappush, heappushpop, heapreplace, merge  # type: ignore
from itertools import accumulate, combinations, permutations, product  # type: ignore
from string import ascii_lowercase, ascii_uppercase # type: ignore

def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode("utf-8").split()
def S(): return sys.stdin.buffer.readline().rstrip().decode("utf-8")
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def SRL(n): return [list(S()) for _ in range(n)]

def solve(n,x):
    ret = x-sum(range(1,n))
    if ret>n-1:
        d = (ret-n+1)//n
        m = (ret-n+1)%n
        if m==0:
            m+=n
            d-=1
        if m<=2:
            ans = list(range(1+d,n+d))+[ret-d*(n-1)]
            return ans[::-1]
        else:
            ans = list(range(1+d,n+d))+[ret-d*(n-1)-(m-2)]
            for i in range(n-2,n-(m-2)-2,-1):
                ans[i]+=1
            return ans[::-1]
    else:
        return [-1]

T = I()
for _ in range(T):
    n,x = LI()
    print(*solve(n,x))
0