結果

問題 No.233 めぐるはめぐる (3)
ユーザー ikdikd
提出日時 2016-07-23 11:07:40
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 197 ms / 1,000 ms
コード長 855 bytes
コンパイル時間 954 ms
コンパイル使用メモリ 77,060 KB
実行使用メモリ 13,568 KB
最終ジャッジ日時 2024-04-24 07:30:55
合計ジャッジ時間 4,006 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
13,056 KB
testcase_01 AC 78 ms
9,600 KB
testcase_02 AC 33 ms
6,656 KB
testcase_03 AC 78 ms
10,496 KB
testcase_04 AC 197 ms
13,440 KB
testcase_05 AC 162 ms
13,568 KB
testcase_06 AC 130 ms
13,440 KB
testcase_07 AC 186 ms
13,568 KB
testcase_08 AC 185 ms
13,440 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 67 ms
9,856 KB
testcase_13 AC 112 ms
13,440 KB
権限があれば一括ダウンロードができます

ソースコード

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++){
                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;
}
0