結果

問題 No.233 めぐるはめぐる (3)
ユーザー face4face4
提出日時 2019-02-13 17:07:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 764 bytes
コンパイル時間 836 ms
コンパイル使用メモリ 79,364 KB
実行使用メモリ 13,632 KB
最終ジャッジ日時 2023-10-11 11:44:13
合計ジャッジ時間 8,186 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

// 21600通り
int main(){
    int n;
    cin >> n;
    set<string> used;
    string s;
    for(int i = 0; i < n; i++){
        cin >> s;
        used.insert(s);
    }
    string vowel = "aaeiuu", conso = "bgmnr";
    // 重複を考慮しない雑な全探索・86400通り
    do{
        do{
            string t({vowel[0]});
            for(int i = 0; i < 5; i++)  t += conso.substr(i,1), t += vowel.substr(i,1);
            if(used.count(t) == 0){
                cout << t << endl;
                return 0;
            }
        }while(next_permutation(conso.begin(), conso.end()));
    }while(next_permutation(vowel.begin(), vowel.end()));
    cout << "NO" << endl;
    return 0;
}
0