結果

問題 No.233 めぐるはめぐる (3)
ユーザー kimiyukikimiyuki
提出日時 2016-01-14 17:53:10
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,022 bytes
コンパイル時間 2,424 ms
コンパイル使用メモリ 78,348 KB
実行使用メモリ 12,660 KB
最終ジャッジ日時 2023-10-19 23:06:22
合計ジャッジ時間 5,860 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
12,396 KB
testcase_01 AC 59 ms
9,012 KB
testcase_02 AC 26 ms
6,144 KB
testcase_03 AC 82 ms
10,596 KB
testcase_04 AC 113 ms
12,660 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 138 ms
12,660 KB
testcase_08 AC 130 ms
12,660 KB
testcase_09 AC 2 ms
4,368 KB
testcase_10 AC 1 ms
4,368 KB
testcase_11 AC 1 ms
4,368 KB
testcase_12 AC 58 ms
9,012 KB
testcase_13 AC 102 ms
12,660 KB
権限があれば一括ダウンロードができます

ソースコード

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 = "iaAeuU"; sort(vowels.begin(), vowels.end());
    do {
        string consonants = "nbmgr"; sort(consonants.begin(), consonants.end());
        do {
            string t;
            repeat (i, vowels.length() + consonants.length()) {
                t += (i % 2 == 0 ? vowels : consonants)[i / 2];
                if (t.back() == 'A') t.back() = 'a';
                if (t.back() == 'U') t.back() = 'u';
            }
            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