結果
問題 |
No.233 めぐるはめぐる (3)
|
ユーザー |
|
提出日時 | 2016-01-14 17:53:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,022 bytes |
コンパイル時間 | 1,061 ms |
コンパイル使用メモリ | 78,628 KB |
実行使用メモリ | 12,648 KB |
最終ジャッジ日時 | 2024-09-19 19:03:52 |
合計ジャッジ時間 | 4,715 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 2 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <unordered_set> #define repeat(i,n) for (int i = 0; (i) < (n); ++(i)) using namespace std; int main() { int n; cin >> n; unordered_set<string> s; repeat (i,n) { string t; cin >> t; s.insert(t); } string vowels = "iaAeuU"; sort(vowels.begin(), vowels.end()); do { string consonants = "nbmgr"; sort(consonants.begin(), consonants.end()); do { string t; repeat (i, vowels.length() + consonants.length()) { t += (i % 2 == 0 ? vowels : consonants)[i / 2]; if (t.back() == 'A') t.back() = 'a'; if (t.back() == 'U') t.back() = 'u'; } if (not s.count(t)) { cout << t << endl; return 0; } } while (next_permutation(consonants.begin(), consonants.end())); } while (next_permutation(vowels.begin(), vowels.end())); cout << "NO" << endl; return 0; }