結果

問題 No.233 めぐるはめぐる (3)
ユーザー なおなお
提出日時 2015-06-27 00:03:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 195 ms / 1,000 ms
コード長 825 bytes
コンパイル時間 1,455 ms
コンパイル使用メモリ 155,792 KB
実行使用メモリ 13,600 KB
最終ジャッジ日時 2023-09-22 02:38:58
合計ジャッジ時間 5,759 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
13,116 KB
testcase_01 AC 84 ms
9,628 KB
testcase_02 AC 36 ms
6,568 KB
testcase_03 AC 94 ms
10,340 KB
testcase_04 AC 157 ms
13,600 KB
testcase_05 AC 174 ms
13,456 KB
testcase_06 AC 173 ms
13,456 KB
testcase_07 AC 188 ms
13,456 KB
testcase_08 AC 195 ms
13,516 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 81 ms
9,720 KB
testcase_13 AC 150 ms
13,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))
#define EACH(it, c)         for(auto it=(c).begin();it!=(c).end();++it)

int main(){
    int N;
    cin >> N;
    set<string> S;
    REP(i,N){
        string s; cin >> s;
        S.insert(s);
    }

    string s0 = "nbmgr*";
    string s1 = "iaaeuu";
    sort(s0.begin(), s0.end());
    sort(s1.begin(), s1.end());

    do {
        do {
            string k;
            REP(i,6){
                if(s0[i] != '*') k += s0[i];
                k += s1[i];
            }
            if(S.count(k)) continue;
            cout << k << endl;
            return 0;
          
        } while(next_permutation(s1.begin(), s1.end()));
    } while(next_permutation(s0.begin(), s0.end()));

    cout << "NO" << endl;
    return 0;
}
0