結果

問題 No.233 めぐるはめぐる (3)
ユーザー yaoshimaxyaoshimax
提出日時 2015-06-28 22:03:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 192 ms / 1,000 ms
コード長 845 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 69,648 KB
実行使用メモリ 13,768 KB
最終ジャッジ日時 2023-09-22 04:05:38
合計ジャッジ時間 5,311 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 155 ms
13,120 KB
testcase_01 AC 86 ms
9,700 KB
testcase_02 AC 34 ms
6,680 KB
testcase_03 AC 99 ms
10,368 KB
testcase_04 AC 188 ms
13,496 KB
testcase_05 AC 169 ms
13,768 KB
testcase_06 AC 168 ms
13,472 KB
testcase_07 AC 192 ms
13,476 KB
testcase_08 AC 189 ms
13,528 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 92 ms
9,848 KB
testcase_13 AC 162 ms
13,368 KB
権限があれば一括ダウンロードができます

ソースコード

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