結果
| 問題 | No.2865 Base 10 Subsets 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-03 18:22:09 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
MLE
不安定
|
| 実行時間 | - |
| コード長 | 1,291 bytes |
| 記録 | |
| コンパイル時間 | 1,480 ms |
| コンパイル使用メモリ | 220,744 KB |
| 実行使用メモリ | 1,299,188 KB |
| 最終ジャッジ日時 | 2026-10-03 18:22:17 |
| 合計ジャッジ時間 | 6,979 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 MLE * 2 -- * 9 |
ソースコード
#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
using i128 = __int128;
int power(i64 a, i64 b) {
i64 res = 1;
for (; b; b /= 2, a = 1LL * a * a) {
if (b % 2) {
res = 1LL * res * a;
}
}
return res;
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i64 n, k;
std::cin >> n >> k;
std::vector<int> f;
while (n) {
f.push_back(n % 10);
n /= 10;
}
std::reverse(f.begin(), f.end());
std::vector<i64> nums, ans;
auto dfs = [&](auto&& self, int dep) -> void {
if (dep == f.size()) {
i64 cur = 0;
// for (int x : nums) std::cout << x << " ";
// std::cout << '\n';
for (int x : nums) {
cur = cur * 10LL + x;
}
ans.push_back(cur);
return ;
}
for (int i = 0; i <= f[dep]; i++) {
nums.push_back(i);
self(self, dep + 1);
nums.pop_back();
}
};
dfs(dfs, 0);
std::sort(ans.begin(), ans.end());
// for (i64 x : ans) std::cout << x << " ";
std::cout << ans[--k] << '\n';
return 0;
}