結果

問題 No.233 めぐるはめぐる (3)
ユーザー pekempey
提出日時 2015-06-26 23:45:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 223 ms / 1,000 ms
コード長 1,017 bytes
コンパイル時間 1,389 ms
コンパイル使用メモリ 167,136 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-07-07 18:37:37
合計ジャッジ時間 4,600 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#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--)
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll inf = 1e9;
const ll mod = 1e9 + 7;

int main() {
    string a = "nbmgr~";
    string b = "iaaeuu";

    int A[6], B[6];

    rep (i, 6) A[i] = i;
    rep (i, 6) B[i] = i;

    set<string> s;

    int n;
    cin >> n;
    rep (i, n) {
        string w;
        cin >> w;
        s.insert(w);
    }

    do {
        do {
            string w;

            rep (i, 6) {
                if (a[A[i]] != '~') w += a[A[i]];
                w += b[B[i]];
            }

            if (!s.count(w)) {
                cout << w << endl;
                return 0;
            }
        } while (next_permutation(B, B + 6));
    } while (next_permutation(A, A + 6));

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