結果

問題 No.233 めぐるはめぐる (3)
コンテスト
ユーザー pekempey
提出日時 2015-06-28 22:38:36
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 123 ms / 1,000 ms
コード長 984 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,271 ms
コンパイル使用メモリ 186,812 KB
実行使用メモリ 13,824 KB
最終ジャッジ日時 2026-03-29 11:52:57
合計ジャッジ時間 3,386 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrep2(i, a, b) for (int i = (a) - 1; i >= (b); i--)
using namespace std;
typedef long long ll;
const ll inf = 1e9;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    set<string> s;
    rep (i, N) {
        string temp;
        cin >> temp;
        s.insert(temp);
    }

    string a = "nbmgr~";
    string b = "iaaeuu";
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    do {
        do {
            string w;
            rep (i, 6) {
                if (a[i] != '~') w += a[i];
                w += b[i];
            }
            if (!s.count(w)) {
                cout << w << endl;
                return 0;
            }
        } while (next_permutation(b.begin(), b.end()));
    } while (next_permutation(a.begin(), a.end()));

    cout << "NO" << endl;
}
0