結果

問題 No.233 めぐるはめぐる (3)
ユーザー maine_honzukimaine_honzuki
提出日時 2021-04-26 18:48:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 992 bytes
コンパイル時間 3,077 ms
コンパイル使用メモリ 215,264 KB
実行使用メモリ 12,788 KB
最終ジャッジ日時 2023-09-18 14:11:41
合計ジャッジ時間 13,419 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
12,216 KB
testcase_01 AC 90 ms
8,768 KB
testcase_02 AC 60 ms
5,860 KB
testcase_03 AC 107 ms
10,504 KB
testcase_04 TLE -
testcase_05 AC 854 ms
12,628 KB
testcase_06 AC 806 ms
12,788 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 37 ms
4,376 KB
testcase_10 AC 38 ms
4,380 KB
testcase_11 AC 37 ms
4,376 KB
testcase_12 AC 89 ms
8,976 KB
testcase_13 AC 132 ms
12,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int N;
    cin >> N;
    unordered_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());
    unordered_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