結果

問題 No.233 めぐるはめぐる (3)
ユーザー koyopro
提出日時 2015-10-18 00:12:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,043 bytes
コンパイル時間 1,547 ms
コンパイル使用メモリ 174,140 KB
実行使用メモリ 22,536 KB
最終ジャッジ日時 2024-07-21 16:41:25
合計ジャッジ時間 6,142 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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