結果

問題 No.233 めぐるはめぐる (3)
コンテスト
ユーザー はむ吉🐹
提出日時 2016-03-02 22:10:13
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 1,303 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 471 ms
コンパイル使用メモリ 84,656 KB
実行使用メモリ 16,544 KB
最終ジャッジ日時 2026-04-11 17:50:19
合計ジャッジ時間 3,807 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 4 TLE * 1 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <algorithm>
#include <cstdlib>
#include <ios>
#include <iostream>
#include <string>
#include <vector>


std::string get_available_name(std::vector<std::string>& used_names) {
	std::string consonants("bgmnr");
	std::string vowels("aaeiuu");
	do {
		do {
			std::string candidate_init;
			for (unsigned int i = 0; i < 5; i++) {
				candidate_init.push_back(consonants[i]);
				candidate_init.push_back(vowels[i]);
			}
			auto last_vowel = vowels.back();
			for (unsigned int i = 0; i <= 10; i++) {
				auto cand_init_copy = candidate_init;
				cand_init_copy.insert(cand_init_copy.begin() + i, last_vowel);
				auto used = std::find(used_names.begin(), used_names.end(), cand_init_copy);
				if (used == used_names.end()) {
					return cand_init_copy;
				}
			}
		} while (std::next_permutation(vowels.begin(), vowels.end()));
	} while (std::next_permutation(consonants.begin(), consonants.end()));
	std::string result("NO");
	return result;
}


int main()
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	unsigned int n;
	std::cin >> n;
	std::vector<std::string> used_names;
	for (unsigned int i = 0; i < n; i++) {
		std::string s;
		std::cin >> s;
		used_names.push_back(s);
	}
	auto result = get_available_name(used_names);
	std::cout << result << std::endl;

	return EXIT_SUCCESS;
}
0