結果
| 問題 | No.233 めぐるはめぐる (3) | 
| コンテスト | |
| ユーザー |  maine_honzuki | 
| 提出日時 | 2021-04-26 18:51:07 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 639 ms / 1,000 ms | 
| コード長 | 1,019 bytes | 
| コンパイル時間 | 2,246 ms | 
| コンパイル使用メモリ | 206,392 KB | 
| 最終ジャッジ日時 | 2025-01-21 01:12:49 | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 | 
ソースコード
#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;
                    break;
                }
                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;
}
            
            
            
        