結果
| 問題 |
No.3030 Kruskal-Katona
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2025-02-21 22:01:20 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 773 bytes |
| コンパイル時間 | 4,520 ms |
| コンパイル使用メモリ | 278,420 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2025-02-21 22:01:28 |
| 合計ジャッジ時間 | 7,005 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 TLE * 1 -- * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;
using LL = __int128;
LL binom(LL n, LL k) {
if (k < 0 || k > n) return 0;
if (k == 0 || k == n) return 1;
if (k > n - k) k = n - k;
LL res = 1;
for (LL i = 0; i < k; i++) res = res * (n - i) / (i + 1);
return res;
}
int main() {
int N, I;
cin >> N >> I;
vector<ll> ans;
LL sum = 0;
int tmp = I;
for (int n = max(N, I) + 10; n >= 1; n--) {
ll now = binom(n, tmp);
if (sum + now <= N && now > 0) {
sum += now;
ans.push_back(n);
tmp--;
if (sum == N || tmp == 1) break;
}
}
for (ll x : ans) cout << x << ' ';
cout << endl;
}
Today03