結果

問題 No.233 めぐるはめぐる (3)
ユーザー h_nosonh_noson
提出日時 2016-06-04 18:03:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 503 ms / 1,000 ms
コード長 991 bytes
コンパイル時間 770 ms
コンパイル使用メモリ 71,524 KB
実行使用メモリ 13,568 KB
最終ジャッジ日時 2024-04-17 00:24:49
合計ジャッジ時間 5,761 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
13,184 KB
testcase_01 AC 88 ms
9,728 KB
testcase_02 AC 41 ms
6,656 KB
testcase_03 AC 97 ms
10,496 KB
testcase_04 AC 485 ms
13,440 KB
testcase_05 AC 284 ms
13,440 KB
testcase_06 AC 273 ms
13,568 KB
testcase_07 AC 503 ms
13,568 KB
testcase_08 AC 489 ms
13,440 KB
testcase_09 AC 8 ms
5,376 KB
testcase_10 AC 8 ms
5,376 KB
testcase_11 AC 8 ms
5,376 KB
testcase_12 AC 87 ms
9,728 KB
testcase_13 AC 143 ms
13,440 KB
権限があれば一括ダウンロードができます

ソースコード

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