結果

問題 No.233 めぐるはめぐる (3)
ユーザー koba-e964koba-e964
提出日時 2015-06-30 21:14:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 220 ms / 1,000 ms
コード長 957 bytes
コンパイル時間 774 ms
コンパイル使用メモリ 83,484 KB
実行使用メモリ 13,692 KB
最終ジャッジ日時 2023-09-22 04:44:08
合計ジャッジ時間 5,393 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
12,996 KB
testcase_01 AC 89 ms
9,676 KB
testcase_02 AC 36 ms
6,464 KB
testcase_03 AC 102 ms
10,364 KB
testcase_04 AC 168 ms
13,628 KB
testcase_05 AC 187 ms
13,572 KB
testcase_06 AC 198 ms
13,692 KB
testcase_07 AC 220 ms
13,404 KB
testcase_08 AC 215 ms
13,552 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 86 ms
9,680 KB
testcase_13 AC 154 ms
13,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS=1e-9;

set<string> pool;

string solve() {
  REP(i, 0, 6) {
    string a = "aaeiuu";
    do {
      string b = "bgmnr";
      do {
	string s;
	REP(j, 0, i) {
	  s += b[j];
	  s += a[j];
	}
	s += a[i];
	REP(j, i, 5) {
	  s += b[j];
	  s += a[j + 1];
	}
	if (!pool.count(s)) {
	  return s;
	}
      } while (next_permutation(b.begin(), b.end()));
    } while (next_permutation(a.begin(), a.end()));
  }
  return "NO";
}
int main(void){
  int n;
  cin >> n;
  REP(i, 0, n) {
    string s;
    cin >> s;
    pool.insert(s);
  }
  cout << solve() << endl;
}
0