結果

問題 No.2567 A_1 > A_2 > ... > A_N
ユーザー ゼットゼット
提出日時 2023-12-21 00:40:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 456 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 92,584 KB
最終ジャッジ日時 2023-12-21 00:40:08
合計ジャッジ時間 6,944 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 282 ms
83,460 KB
testcase_02 AC 324 ms
89,248 KB
testcase_03 AC 284 ms
88,008 KB
testcase_04 AC 341 ms
88,616 KB
testcase_05 AC 343 ms
92,584 KB
testcase_06 AC 419 ms
77,388 KB
testcase_07 AC 407 ms
77,352 KB
testcase_08 AC 456 ms
78,684 KB
testcase_09 AC 401 ms
77,488 KB
testcase_10 AC 352 ms
77,024 KB
testcase_11 AC 47 ms
59,332 KB
testcase_12 AC 64 ms
72,692 KB
testcase_13 AC 51 ms
63,904 KB
testcase_14 AC 37 ms
53,460 KB
testcase_15 AC 66 ms
70,632 KB
testcase_16 AC 50 ms
63,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())
for _ in range(Q):
  N,X=map(int,input().split())
  score=N*(N+1)//2
  if X<score:
    print(-1)
    continue
  result=[]
  for x in range(N,1,-1):
    l=1
    r=10**18
    while True:
      m=(l+r)//2
      w1=m
      w2=m-(x-1)
      score=x*(w1+w2)//2
      if score>=X:
        r=m
      else:
        l=m+1
      if l==r:
        break
    result.append(l)
    X-=l
  result.append(X)
  print(*result)
0