結果

問題 No.233 めぐるはめぐる (3)
ユーザー maine_honzukimaine_honzuki
提出日時 2021-04-26 18:51:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 621 ms / 1,000 ms
コード長 1,019 bytes
コンパイル時間 3,433 ms
コンパイル使用メモリ 212,168 KB
実行使用メモリ 13,612 KB
最終ジャッジ日時 2023-09-18 14:13:49
合計ジャッジ時間 8,906 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
13,060 KB
testcase_01 AC 93 ms
9,676 KB
testcase_02 AC 45 ms
6,504 KB
testcase_03 AC 102 ms
10,480 KB
testcase_04 AC 612 ms
13,492 KB
testcase_05 AC 338 ms
13,612 KB
testcase_06 AC 332 ms
13,496 KB
testcase_07 AC 616 ms
13,536 KB
testcase_08 AC 621 ms
13,608 KB
testcase_09 AC 11 ms
4,376 KB
testcase_10 AC 11 ms
4,376 KB
testcase_11 AC 11 ms
4,376 KB
testcase_12 AC 95 ms
9,800 KB
testcase_13 AC 156 ms
13,380 KB
権限があれば一括ダウンロードができます

ソースコード

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;
                    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;
}
0