結果

問題 No.233 めぐるはめぐる (3)
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2022-12-31 04:58:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 307 ms / 1,000 ms
コード長 1,046 bytes
コンパイル時間 2,088 ms
コンパイル使用メモリ 118,780 KB
実行使用メモリ 13,584 KB
最終ジャッジ日時 2023-08-17 08:19:54
合計ジャッジ時間 6,270 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
13,272 KB
testcase_01 AC 79 ms
9,680 KB
testcase_02 AC 33 ms
6,512 KB
testcase_03 AC 88 ms
10,420 KB
testcase_04 AC 253 ms
13,584 KB
testcase_05 AC 221 ms
13,480 KB
testcase_06 AC 183 ms
13,508 KB
testcase_07 AC 304 ms
13,460 KB
testcase_08 AC 307 ms
13,460 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 77 ms
9,720 KB
testcase_13 AC 135 ms
13,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;

int main(){

    int N;
    cin >> N;
    string S = "iaaeuu", T = "nbmgr", U, V, W;
    vector<int> a(6), b(5);
    set<string> st;
    for (int i=0; i<N; i++){
        cin >> W;
        st.insert(W);
    }
    iota(a.begin(), a.end(), 0); iota(b.begin(), b.end(), 0);

    do{
        do{
            U = "";
            for (int i=0; i<5; i++){
                U += T[b[i]];
                U += S[a[i]];
            }
            for (int i=0; i<11; i+=2){
                V = U.substr(0, i) + S[a[5]] + U.substr(i);
                if (!st.count(V)){
                    cout << V << endl;
                    return 0;
                }
            }
        } while(next_permutation(b.begin(), b.end()));
    } while(next_permutation(a.begin(), a.end()));

    cout << "NO" << endl;

    return 0;
}
0