結果

問題 No.233 めぐるはめぐる (3)
ユーザー kimiyuki
提出日時 2016-01-14 18:00:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 97 ms / 1,000 ms
コード長 930 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 76,728 KB
実行使用メモリ 12,644 KB
最終ジャッジ日時 2024-09-19 19:03:57
合計ジャッジ時間 3,365 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

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