結果

問題 No.233 めぐるはめぐる (3)
ユーザー not_522not_522
提出日時 2015-08-20 14:38:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 388 ms / 1,000 ms
コード長 685 bytes
コンパイル時間 1,471 ms
コンパイル使用メモリ 156,764 KB
実行使用メモリ 13,744 KB
最終ジャッジ日時 2023-09-25 13:50:33
合計ジャッジ時間 9,378 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 378 ms
13,584 KB
testcase_01 AC 347 ms
13,492 KB
testcase_02 AC 302 ms
13,504 KB
testcase_03 AC 361 ms
13,500 KB
testcase_04 AC 388 ms
13,500 KB
testcase_05 AC 386 ms
13,560 KB
testcase_06 AC 384 ms
13,452 KB
testcase_07 AC 386 ms
13,744 KB
testcase_08 AC 383 ms
13,468 KB
testcase_09 AC 257 ms
13,616 KB
testcase_10 AC 258 ms
13,472 KB
testcase_11 AC 258 ms
13,468 KB
testcase_12 AC 344 ms
13,500 KB
testcase_13 AC 386 ms
13,464 KB
権限があれば一括ダウンロードができます

ソースコード

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