結果

問題 No.233 めぐるはめぐる (3)
ユーザー ldsybldsyb
提出日時 2016-04-07 20:02:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 210 ms / 1,000 ms
コード長 837 bytes
コンパイル時間 1,022 ms
コンパイル使用メモリ 85,732 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-04-19 07:14:43
合計ジャッジ時間 5,259 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
13,312 KB
testcase_01 AC 73 ms
9,856 KB
testcase_02 AC 33 ms
6,940 KB
testcase_03 AC 83 ms
10,624 KB
testcase_04 AC 201 ms
13,696 KB
testcase_05 AC 160 ms
13,696 KB
testcase_06 AC 144 ms
13,568 KB
testcase_07 AC 210 ms
13,568 KB
testcase_08 AC 210 ms
13,568 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 72 ms
9,984 KB
testcase_13 AC 124 ms
13,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <set>
using namespace std;

int main(){
   set<string> s;
   int n;
   cin >> n;
   for(int i = 0;i < n;i++){
      string str;
      cin >> str;
      s.insert(str);
   }
   string a = "iaaeuu",b = "nbmgr";
   stable_sort(a.begin(),a.end());
   stable_sort(b.begin(),b.end());
   do{
      do{
         string tmp = "          ";
         for(int i = 0;i < 5;i++){
            tmp[i * 2] = b[i];
            tmp[i * 2 + 1] = a[i];
         }
         for(int i = 0;i < 11;i++){
            string str = tmp.substr(0,i) + a[5] + tmp.substr(i);
            if(!s.count(str)){
               cout << str << endl;
               return 0;
            }
         }
      }while(next_permutation(b.begin(),b.end()));
   }while(next_permutation(a.begin(),a.end()));
   cout << "NO" << endl;
}
0