結果
| 問題 | No.233 めぐるはめぐる (3) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-06-28 22:11:08 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 137 ms / 1,000 ms | 
| コード長 | 936 bytes | 
| コンパイル時間 | 825 ms | 
| コンパイル使用メモリ | 74,004 KB | 
| 実行使用メモリ | 13,440 KB | 
| 最終ジャッジ日時 | 2024-07-07 20:53:13 | 
| 合計ジャッジ時間 | 3,473 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 | 
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <set>
using namespace std;
int main() {
	int n;
	string name;
	cin >> n;
	set<string> names;
	for (int i = 0; i < n; i++) {
		cin >> name;
		names.insert(name);
	}
	string boin  =  "nbmgr";
	string shiin = "iaaeuu";
	int n_boin = boin.size();
	int n_shiin = shiin.size();
	sort(boin.begin(), boin.end());
	sort(shiin.begin(), shiin.end());
	do {
		do {
			for (int i = 0; i < n_shiin; i++) {
				name.clear();
				int idx_b = 0;
				for (int j = 0; j < n_shiin; j++) {
					if (j != i) {
						name += boin[idx_b];
						idx_b++;
					}
					name += shiin[j];
				}
				if (names.count(name) == 0) {
					cout << name << endl;
					return 0;
				}
			}
		} while (next_permutation(boin.begin(), boin.end()));
	} while (next_permutation(shiin.begin(), shiin.end()));
	cout << "NO" << endl;
	return 0;
}
            
            
            
        