結果
| 問題 |
No.233 めぐるはめぐる (3)
|
| コンテスト | |
| ユーザー |
koyopro
|
| 提出日時 | 2015-10-18 00:20:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 182 ms / 1,000 ms |
| コード長 | 977 bytes |
| コンパイル時間 | 1,763 ms |
| コンパイル使用メモリ | 172,200 KB |
| 実行使用メモリ | 13,696 KB |
| 最終ジャッジ日時 | 2024-07-21 16:44:00 |
| 合計ジャッジ時間 | 5,665 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(int i=0; i<(n); i++)
#define ALL(a) (a).begin(),(a).end()
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
int N,T;
map<string, bool> has;
signed main()
{
cin >> N;
string s;
REP(i,N) {
cin >> s;
has[s] = true;
}
string vowels = "iaaeuu";
string consonants = "tnbmgr";
sort(ALL(vowels));
sort(ALL(consonants));
string t = "";
bool ok = false;
do {
do {
t = "";
REP(i,6) {
char c = consonants[i];
if (c != 't') t += c;
t += vowels[i];
}
if (!has[t]) {
ok = true;
break;
}
}while(next_permutation(ALL(consonants)));
if (ok) break;
}while(next_permutation(ALL(vowels)));
if (ok) {
cout << t << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
koyopro