結果

問題 No.233 めぐるはめぐる (3)
ユーザー maine_honzukimaine_honzuki
提出日時 2021-04-26 18:47:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 972 bytes
コンパイル時間 7,177 ms
コンパイル使用メモリ 206,336 KB
最終ジャッジ日時 2025-01-21 01:12:05
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    cin >> N;
    set<string> used;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        used.insert(s);
    }
    string sabbat_of_the_witch = "inabameguru";
    sort(sabbat_of_the_witch.begin(), sabbat_of_the_witch.end());
    set<char> boin({'a', 'i', 'u', 'e', 'o'});
    do {
        bool flag = true, shiin = false;
        for (auto&& c : sabbat_of_the_witch) {
            if (boin.count(c)) {
                shiin = false;
            } else {
                if (shiin == true)
                    flag = false;
                shiin = true;
            }
        }
        if (flag && boin.count(sabbat_of_the_witch.back()) && used.count(sabbat_of_the_witch) == 0) {
            cout << sabbat_of_the_witch << endl;
            return 0;
        }
    } while (next_permutation(sabbat_of_the_witch.begin(), sabbat_of_the_witch.end()));
    cout << "NO" << endl;
}
0