結果

問題 No.233 めぐるはめぐる (3)
ユーザー yaoshimax
提出日時 2015-06-28 22:03:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 176 ms / 1,000 ms
コード長 845 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 70,288 KB
実行使用メモリ 13,568 KB
最終ジャッジ日時 2024-07-07 20:53:03
合計ジャッジ時間 4,543 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
int main(){
   int N;
   cin >> N;
   set<string> S;
   for( int i = 0 ; i < N; i++ ){
      string s;
      cin >> s;
      S.insert(s);
   }
   string boin="aaeiuu";
   string siin="bgmnr";
   int p1[]={0,1,2,3,4};
   int p2[]={0,1,2,3,4};
   do{
      do{
         for( int pos=0 ; pos<6; pos++ ){
            string s="";
            for( int i=0; i<5; i++){
               if( i==pos ) s+= boin[5];
               s+=siin[p1[i]];
               s+=boin[p2[i]];
            }
            if( pos==5 ) s+= boin[5];
            if( S.find(s) == S.end() ){
               cout << s<< endl;
               return 0;
            }
         }

      }while( next_permutation(p2,p2+5) );
   }while( next_permutation(p1,p1+5) );
   cout << "NO"<<endl;
}
0