結果
| 問題 | No.2865 Base 10 Subsets 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-03 18:33:01 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
MLE
不安定
|
| 実行時間 | - |
| コード長 | 1,048 bytes |
| 記録 | |
| コンパイル時間 | 1,515 ms |
| コンパイル使用メモリ | 223,188 KB |
| 実行使用メモリ | 1,297,196 KB |
| 最終ジャッジ日時 | 2026-10-03 18:33:11 |
| 合計ジャッジ時間 | 5,458 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_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, i64 cur) -> void {
if (dep == f.size()) {
ans.push_back(cur);
return ;
}
for (int i = 0; i <= f[dep]; i++) {
self(self, dep + 1, cur * 10 + i);
}
};
dfs(dfs, 0, 0);
std::sort(ans.begin(), ans.end());
// for (i64 x : ans) std::cout << x << " ";
std::cout << ans[--k] << '\n';
return 0;
}