結果
問題 | No.233 めぐるはめぐる (3) |
ユーザー |
|
提出日時 | 2015-06-30 21:14:23 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 176 ms / 1,000 ms |
コード長 | 957 bytes |
コンパイル時間 | 799 ms |
コンパイル使用メモリ | 84,048 KB |
実行使用メモリ | 13,568 KB |
最終ジャッジ日時 | 2024-07-07 21:30:05 |
合計ジャッジ時間 | 4,132 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
ソースコード
#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; }