結果

問題 No.233 めぐるはめぐる (3)
ユーザー pekempeypekempey
提出日時 2015-06-26 23:45:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 248 ms / 1,000 ms
コード長 1,017 bytes
コンパイル時間 1,422 ms
コンパイル使用メモリ 152,800 KB
実行使用メモリ 13,588 KB
最終ジャッジ日時 2023-09-22 01:47:33
合計ジャッジ時間 5,643 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
13,076 KB
testcase_01 AC 78 ms
9,904 KB
testcase_02 AC 33 ms
6,460 KB
testcase_03 AC 85 ms
10,448 KB
testcase_04 AC 243 ms
13,452 KB
testcase_05 AC 203 ms
13,432 KB
testcase_06 AC 192 ms
13,460 KB
testcase_07 AC 243 ms
13,580 KB
testcase_08 AC 248 ms
13,588 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 76 ms
9,704 KB
testcase_13 AC 132 ms
13,408 KB
権限があれば一括ダウンロードができます

ソースコード

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