結果

問題 No.233 めぐるはめぐる (3)
ユーザー face4face4
提出日時 2019-02-13 17:29:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 191 ms / 1,000 ms
コード長 989 bytes
コンパイル時間 817 ms
コンパイル使用メモリ 78,796 KB
実行使用メモリ 13,552 KB
最終ジャッジ日時 2023-10-11 12:19:35
合計ジャッジ時間 4,650 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
13,404 KB
testcase_01 AC 69 ms
9,728 KB
testcase_02 AC 32 ms
6,504 KB
testcase_03 AC 85 ms
10,412 KB
testcase_04 AC 190 ms
13,496 KB
testcase_05 AC 158 ms
13,500 KB
testcase_06 AC 138 ms
13,500 KB
testcase_07 AC 191 ms
13,552 KB
testcase_08 AC 183 ms
13,492 KB
testcase_09 AC 1 ms
4,356 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 76 ms
9,792 KB
testcase_13 AC 130 ms
13,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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";
    do{
        do{
            for(int i = 0; i < 6; i++){
                string t = "";
                int vpos = 0, cpos = 0;
                for(int j = 0; j < 5; j++){
                    if(i == j)  t += vowel.substr(vpos++, 1);
                    t += conso.substr(cpos++, 1);
                    t += vowel.substr(vpos++, 1);
                }
                if(i == 5)  t += vowel.substr(vpos++, 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