結果

問題 No.233 めぐるはめぐる (3)
ユーザー ikd
提出日時 2016-07-23 11:03:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 850 bytes
コンパイル時間 817 ms
コンパイル使用メモリ 78,492 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-11-06 14:47:40
合計ジャッジ時間 6,473 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#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++){
                s=s.substr(0, i)+bo.back()+s.substr(i);
                if(mp.find(s)==mp.end()){
                    cout<< s<< endl;
                    return 0;
                }
            }
        }while(next_permutation(si.begin(), si.end()));
    }while(next_permutation(bo.begin(), bo.end()));

    cout<< "NO"<< endl;
    return 0;
}
0