結果

問題 No.2671 NUPC Decompressor
ユーザー nono00nono00
提出日時 2024-03-15 21:25:33
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 771 bytes
コンパイル時間 3,421 ms
コンパイル使用メモリ 265,436 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-15 21:25:37
合計ジャッジ時間 4,199 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

namespace nono {

void solve() {
    const std::string S = "NUPC";
    std::vector<std::string> vec;
    auto dfs = [&](auto self, int i, std::string s) -> void {
        if (i == 8) {
            vec.push_back(s);
            return;
        }
        if (i % 2 == 0) {
            s.push_back(S[i / 2]);
            self(self, i + 1, s);
        } else {
            self(self, i + 1, s);
            self(self, i + 1, s + s);
        }
    };
    dfs(dfs, 0, "");
    std::ranges::sort(vec);
    int k;
    std::cin >> k;
    std::cout << vec[k - 1] << '\n';
}

}  //  namespace nono

int main() {
    std::cin.tie(0)->sync_with_stdio(0);
    std::cout << std::fixed << std::setprecision(16);
    int t = 1;

    while (t--) nono::solve();
}
0