結果

問題 No.233 めぐるはめぐる (3)
ユーザー masa
提出日時 2015-06-28 21:38:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 880 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 73,812 KB
実行使用メモリ 13,568 KB
最終ジャッジ日時 2024-07-07 20:51:06
合計ジャッジ時間 3,947 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#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());

	name = "inabameguru";
	do {
		do {
			for (int i = 0; i < n_shiin; i++) {
				name[2 * i] = shiin[i];
			}
			for (int i = 0; i < n_boin; i++) {
				name[2 * i + 1] = boin[i];
			}
			if (names.count(name) == 0) {
				cout << name << endl;
				return 0;
			}
		} while (next_permutation(boin.begin(), boin.end()));
	} while (next_permutation(shiin.begin(), shiin.begin()));

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