結果

問題 No.233 めぐるはめぐる (3)
ユーザー kimiyukikimiyuki
提出日時 2016-01-14 18:00:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 930 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 76,896 KB
実行使用メモリ 12,668 KB
最終ジャッジ日時 2023-10-19 23:06:27
合計ジャッジ時間 4,012 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
12,404 KB
testcase_01 AC 51 ms
9,020 KB
testcase_02 AC 23 ms
6,144 KB
testcase_03 AC 66 ms
10,604 KB
testcase_04 AC 133 ms
12,668 KB
testcase_05 AC 110 ms
12,668 KB
testcase_06 AC 103 ms
12,668 KB
testcase_07 AC 136 ms
12,668 KB
testcase_08 AC 136 ms
12,668 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 52 ms
9,020 KB
testcase_13 AC 91 ms
12,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
using namespace std;
int main() {
    int n; cin >> n;
    unordered_set<string> s;
    repeat (i,n) {
        string t; cin >> t;
        s.insert(t);
    }
    string vowels = "aaeiuu";
    do {
        string consonants = "bgmnr";
        do {
            repeat (i, 5) {
                string t;
                repeat (j, 5) {
                    if (i == j) t += vowels[5];
                    t += consonants[j];
                    t += vowels[j];
                }
                if (not s.count(t)) {
                    cout << t << endl;
                    return 0;
                }
            }
        } while (next_permutation(consonants.begin(), consonants.end()));
    } while (next_permutation(vowels.begin(), vowels.end()));
    cout << "NO" << endl;
    return 0;
}
0