結果
| 問題 |
No.233 めぐるはめぐる (3)
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-03-02 22:10:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,303 bytes |
| コンパイル時間 | 701 ms |
| コンパイル使用メモリ | 68,544 KB |
| 実行使用メモリ | 15,496 KB |
| 最終ジャッジ日時 | 2024-09-24 13:34:13 |
| 合計ジャッジ時間 | 4,251 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 4 TLE * 1 -- * 6 |
ソースコード
#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;
}
はむ吉🐹