結果
| 問題 |
No.3030 Kruskal-Katona
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-02-23 16:27:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,638 ms / 2,000 ms |
| コード長 | 594 bytes |
| コンパイル時間 | 524 ms |
| コンパイル使用メモリ | 56,464 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-02-23 16:27:27 |
| 合計ジャッジ時間 | 3,617 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%d%d", &n, &i);
| ~~~~~^~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 3030.cc: No.3030 Kruskal-Katona - yukicoder
*/
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
/* typedef */
using ll = long long;
using vi = vector<int>;
/* main */
int main() {
int n, i;
scanf("%d%d", &n, &i);
vi v;
while (n > 0) {
// x+1_C_k = x_C_k * (x+1) / (x-k+1)
ll c = 1;
int x = i;
while (c * (x + 1) / (x - i + 1) <= n) {
c = c * (x + 1) / (x - i + 1);
x++;
}
n -= c;
i--;
v.push_back(x);
}
for (auto x: v) printf("%d ", x); putchar('\n');
return 0;
}
tnakao0123