結果

問題 No.3030 Kruskal-Katona
ユーザー dp_ijk
提出日時 2025-02-21 21:56:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 82,524 KB
実行使用メモリ 76,468 KB
最終ジャッジ日時 2025-02-21 21:56:25
合計ジャッジ時間 2,804 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

def bin_search(ok, ng, is_ok):
   while abs(ok-ng) > 1:
      mid = (ok+ng)//2
      if is_ok(mid):
         ok = mid
      else:
         ng = mid
   return ok


def solve(N, i):
   from math import comb as C
   if N == 0:
      return []
   n = bin_search(i, max(i,N)+1, lambda n: C(n, i) <= N)
   N -= C(n, i)
   return [n] + solve(N, i-1)


N, i = map(int, input().split())
res = solve(N, i)
print(*res)
0