結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
13,112 KB
testcase_01 AC 82 ms
9,672 KB
testcase_02 AC 35 ms
6,476 KB
testcase_03 AC 92 ms
10,388 KB
testcase_04 AC 152 ms
13,472 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 157 ms
13,436 KB
testcase_08 AC 154 ms
13,432 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 83 ms
9,944 KB
testcase_13 AC 148 ms
13,280 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";
	long long cnt = 0;
	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.end()));

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