結果
| 問題 | No.233 めぐるはめぐる (3) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-09-04 17:29:54 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 207 ms / 1,000 ms | 
| コード長 | 1,519 bytes | 
| コンパイル時間 | 1,125 ms | 
| コンパイル使用メモリ | 88,924 KB | 
| 最終ジャッジ日時 | 2025-01-14 04:36:05 | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
void solve() {
    std::vector<std::string> vow, con;
    {
        std::string s = "aaeiuu";
        do {
            vow.push_back(s);
        } while (std::next_permutation(s.begin(), s.end()));
        s = "bgmnr";
        do {
            con.push_back(s);
        } while (std::next_permutation(s.begin(), s.end()));
    }
    std::vector<std::string> ss;
    for (int b = 0; b < (1 << 11); ++b) {
        if (__builtin_popcount(b) != 5 ||
            ((b >> 10) & 1) ||
            (b & (b >> 1))) continue;
        for (const auto& s : vow) {
            for (const auto& t : con) {
                std::string r;
                int si = 0, ti = 0;
                for (int i = 0; i < 11; ++i) {
                    if ((b >> i) & 1) {
                        r.push_back(t[ti++]);
                    } else {
                        r.push_back(s[si++]);
                    }
                }
                ss.push_back(r);
            }
        }
    }
    std::set<std::string> ts;
    {
        int n;
        std::cin >> n;
        while (n--) {
            std::string t;
            std::cin >> t;
            ts.insert(t);
        }
    }
    for (const auto& s : ss) {
        if (ts.count(s)) continue;
        std::cout << s << "\n";
        return;
    }
    std::cout << "NO\n";
}
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
    return 0;
}
            
            
            
        