結果

問題 No.233 めぐるはめぐる (3)
ユーザー koyoprokoyopro
提出日時 2015-10-18 00:13:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,045 bytes
コンパイル時間 1,456 ms
コンパイル使用メモリ 157,460 KB
実行使用メモリ 22,380 KB
最終ジャッジ日時 2023-09-28 21:55:36
合計ジャッジ時間 6,036 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
16,664 KB
testcase_01 AC 85 ms
11,740 KB
testcase_02 AC 37 ms
7,660 KB
testcase_03 AC 103 ms
12,748 KB
testcase_04 AC 206 ms
22,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 204 ms
22,232 KB
testcase_08 AC 204 ms
22,240 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 88 ms
11,976 KB
testcase_13 AC 154 ms
16,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define REP(i, n) for(int i=0; i<(n); i++)
#define ALL(a) (a).begin(),(a).end()
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()

int N,T;
map<string, bool> check;
vector<string> S;
map<string, bool> has;
signed main()
{
    cin >> N;
    S.resize(N);
    REP(i,N) {
        cin >> S[i];
        has[S[i]] = true;
    }
    string vowels = "iaaeuu";
    string consonants = "tnbmgr";
    string t = "";
    bool ok = false;
    do {
        do {
            t = "";
            REP(i,6) {
                char c = consonants[i];
                if (c != 't') t += c;
                t += vowels[i];
            }
            //if (check[t]) continue;
            if (!has[t]) {
                ok = true;
                break;
            }
            check[t] = true;
        }while(next_permutation(ALL(consonants)));
        if (ok) break;
    }while(next_permutation(ALL(vowels)));
    if (ok) {
        cout << t << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}
0