結果

問題 No.233 めぐるはめぐる (3)
ユーザー masamasa
提出日時 2015-06-28 21:38:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 880 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 75,044 KB
実行使用メモリ 13,680 KB
最終ジャッジ日時 2023-09-22 04:04:06
合計ジャッジ時間 5,609 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
13,160 KB
testcase_01 AC 84 ms
9,636 KB
testcase_02 AC 35 ms
6,588 KB
testcase_03 AC 97 ms
10,340 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 155 ms
13,556 KB
testcase_08 AC 153 ms
13,680 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 87 ms
9,800 KB
testcase_13 AC 152 ms
13,368 KB
権限があれば一括ダウンロードができます

ソースコード

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