結果
| 問題 |
No.233 めぐるはめぐる (3)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-10 19:05:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 157 ms / 1,000 ms |
| コード長 | 1,326 bytes |
| コンパイル時間 | 1,736 ms |
| コンパイル使用メモリ | 176,544 KB |
| 実行使用メモリ | 13,440 KB |
| 最終ジャッジ日時 | 2024-11-29 02:00:56 |
| 合計ジャッジ時間 | 5,551 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
string solve()
{
int n;
set<string> s;
cin >>n;
rep(i,n)
{
string used;
cin >>used;
s.insert(used);
}
if(n>=129600) return "NO";
string x="bgmnr", y="aaeiuu";
do{
rep(i,6)
{
string z="";
char sel=y[i];
rep(j,6)if(j!=i) z+=y[j];
do{
// sel として選んだ母音を入れる位置
rep(j,6)
{
string name="";
if(j==0) name+=sel;
rep(k,5)
{
name+=x[k];
name+=z[k];
if(j==k+1) name+=sel;
}
if(s.find(name) == s.end()) return name;
}
}while(next_permutation(all(z)));
}
}while(next_permutation(all(x)));
return "NO";
}
int main()
{
cin.tie(0);ios::sync_with_stdio(false);
cout << solve() << '\n';
return 0;
}