結果
| 問題 | No.233 めぐるはめぐる (3) | 
| コンテスト | |
| ユーザー |  ikd | 
| 提出日時 | 2016-07-23 11:07:40 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 235 ms / 1,000 ms | 
| コード長 | 855 bytes | 
| コンパイル時間 | 933 ms | 
| コンパイル使用メモリ | 76,956 KB | 
| 実行使用メモリ | 13,440 KB | 
| 最終ジャッジ日時 | 2024-11-06 14:47:52 | 
| 合計ジャッジ時間 | 4,814 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 | 
ソースコード
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
int main(){
    int N;
    cin>> N;
    map<string, int> mp;
    for(int i=0; i<N; i++){
        string S;
        cin>> S;
        mp[S]++;
    }
    string si="bgmnr", bo="aaeiuu";
    sort(si.begin(), si.end());
    sort(bo.begin(), bo.end());
    do{
        do{
            string s;
            for(int i=0; i<5; i++){
                s=s+si[i]+bo[i];
            }
            for(int i=0; i<11; i++){
                auto t=s.substr(0, i)+bo.back()+s.substr(i);
                if(mp.find(t)==mp.end()){
                    cout<< t<< endl;
                    return 0;
                }
            }
        }while(next_permutation(si.begin(), si.end()));
    }while(next_permutation(bo.begin(), bo.end()));
    cout<< "NO"<< endl;
    return 0;
}
            
            
            
        