結果

問題 No.2766 Delicious Multiply Spice
ユーザー VvyLw
提出日時 2024-06-01 11:21:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 851 bytes
コンパイル時間 4,087 ms
コンパイル使用メモリ 98,748 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-21 17:22:11
合計ジャッジ時間 5,347 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 8
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <unordered_map>
constexpr auto VvyLw = "Huitloxopetl";
int main() {
	std::cin.tie(nullptr) -> sync_with_stdio(false);
    int64_t n;
    std::cin >> n;
    std::unordered_map<int64_t, std::string> m;
    const auto act = [&](const auto &f, const int64_t i) -> std::string {
        if(m.contains(i)) {
            return m[i];
        }
        if(i == 1) {
            return "";
        }
        std::string s = "Huitloxopetl";
        if(i % 2 == 1) {
            const std::string t = f(f, (i - 1) / 2);
            if(t != VvyLw) {
                s = t + "A";
            }
        }
        if(i % 3 == 1) {
            const std::string t = f(f, (i - 1) / 3);
            if(t != VvyLw) {
                s = t + "B";
            }
        }
        return m[i] = s;
    };
    std::cout << act(act, n) << '\n';
}
0