結果

問題 No.233 めぐるはめぐる (3)
ユーザー h_noson
提出日時 2016-06-04 18:03:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 490 ms / 1,000 ms
コード長 991 bytes
コンパイル時間 865 ms
コンパイル使用メモリ 71,352 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-10-08 08:03:59
合計ジャッジ時間 5,543 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

#define REP(i,s,e) for (i = s; i <= e; i++)
#define rep(i,n) REP (i,0,(int)(n)-1)
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP (i,(int)(n)-1,0)
#define INF (int)1e8
#define MOD (int)(1e9+7)

typedef long long ll;

int cnt[11][256];

int main(void) {
    int i, j, n;
    string vowel = "aiueo";
    set<string> st;
    string s;
    cin >> n;
    while (n--) {
        cin >> s;
        st.insert(s);
    }
    s = "aabegimnruu";
    do {
        bool prev = true;
        rep (i,11) {
            bool is_vowel = false;
            for (auto c : vowel) is_vowel |= c == s[i];
            if (!prev && !is_vowel) break;
            prev = is_vowel;
        }
        if (!prev) continue;
        if (!st.count(s)) {
            cout << s << endl;
            return 0;
        }
    } while (next_permutation(s.begin(),s.end()));
    cout << "NO" << endl;
    return 0;
}
0