結果

問題 No.233 めぐるはめぐる (3)
ユーザー not_522
提出日時 2015-08-20 14:38:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 293 ms / 1,000 ms
コード長 685 bytes
コンパイル時間 1,212 ms
コンパイル使用メモリ 171,800 KB
実行使用メモリ 13,568 KB
最終ジャッジ日時 2024-07-18 10:52:45
合計ジャッジ時間 6,792 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

inline bool isVowel(char c) {
  return c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o';
}

int main() {
  string str = "inabameguru";
  sort(str.begin(), str.end());
  set<string> s;
  do {
    if (!isVowel(str.back())) continue;
    char p = 'a';
    bool ok = true;
    for (char c : str) {
      if (!isVowel(p) && !isVowel(c)) ok = false;
      p = c;
    }
    if (ok) s.insert(str);
  } while (next_permutation(str.begin(), str.end()));
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string str;
    cin >> str;
    s.erase(str);
  }
  if (s.empty()) cout << "NO" << endl;
  else cout << *(s.begin()) << endl;
}
0