結果
| 問題 | No.2865 Base 10 Subsets 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-30 23:00:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,004 bytes |
| 記録 | |
| コンパイル時間 | 1,727 ms |
| コンパイル使用メモリ | 144,492 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-08-30 23:00:31 |
| 合計ジャッジ時間 | 2,393 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 WA * 11 |
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#ifdef local
#include <C++/core/io/debug_print.hpp>
#else
#define dump(...) void(0);
#endif
#include <iostream>
#include <valarray>
#include <algorithm>
#include <ranges>
namespace man {
}
int main() {
std::cin.tie(nullptr) -> sync_with_stdio(false);
std::string n;
int64_t k;
std::cin >> n >> k;
const auto sol = [&](const std::string &t) -> std::string {
int64_t now = 1;
std::string s;
for(const auto &e: t | std::views::reverse) {
const int f = e - '0' + 1;
if(now * f >= k) {
for(const auto &i: std::views::iota(0, f)) {
if(now + i == k) {
s += i + '0';
std::ranges::reverse(s);
return s;
}
}
}
now *= f;
s += e;
}
return s;
};
std::cout << sol(n) << '\n';
}