結果
| 問題 | No.233 めぐるはめぐる (3) | 
| コンテスト | |
| ユーザー |  srjywrdnprkt | 
| 提出日時 | 2022-12-31 04:58:49 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 308 ms / 1,000 ms | 
| コード長 | 1,046 bytes | 
| コンパイル時間 | 1,069 ms | 
| コンパイル使用メモリ | 117,300 KB | 
| 最終ジャッジ日時 | 2025-02-09 22:21:51 | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 | 
ソースコード
#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;
}
            
            
            
        