結果
| 問題 | 
                            No.233 めぐるはめぐる (3)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-02-13 17:29:00 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 196 ms / 1,000 ms | 
| コード長 | 989 bytes | 
| コンパイル時間 | 890 ms | 
| コンパイル使用メモリ | 78,772 KB | 
| 実行使用メモリ | 13,696 KB | 
| 最終ジャッジ日時 | 2024-09-13 11:07:35 | 
| 合計ジャッジ時間 | 4,741 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 | 
ソースコード
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
int main(){
    int n;
    cin >> n;
    set<string> used;
    string s;
    for(int i = 0; i < n; i++){
        cin >> s;
        used.insert(s);
    }
    string vowel = "aaeiuu", conso = "bgmnr";
    do{
        do{
            for(int i = 0; i < 6; i++){
                string t = "";
                int vpos = 0, cpos = 0;
                for(int j = 0; j < 5; j++){
                    if(i == j)  t += vowel.substr(vpos++, 1);
                    t += conso.substr(cpos++, 1);
                    t += vowel.substr(vpos++, 1);
                }
                if(i == 5)  t += vowel.substr(vpos++, 1);
                if(used.count(t) == 0){
                    cout << t << endl;
                    return 0;
                }
            }
        }while(next_permutation(conso.begin(), conso.end()));
    }while(next_permutation(vowel.begin(), vowel.end()));
    cout << "NO" << endl;
    return 0;
}