結果

問題 No.233 めぐるはめぐる (3)
ユーザー beetbeet
提出日時 2018-11-15 17:34:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 800 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 209,684 KB
実行使用メモリ 13,808 KB
最終ジャッジ日時 2023-08-26 01:21:21
合計ジャッジ時間 10,244 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
13,080 KB
testcase_01 AC 81 ms
9,960 KB
testcase_02 AC 45 ms
6,760 KB
testcase_03 AC 89 ms
10,356 KB
testcase_04 TLE -
testcase_05 AC 574 ms
13,484 KB
testcase_06 AC 545 ms
13,540 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 7 ms
4,380 KB
testcase_10 AC 7 ms
4,376 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 85 ms
9,804 KB
testcase_13 AC 127 ms
13,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  set<string> ss;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    ss.emplace(s);
  }
  
  string b="inabameguru";
  sort(b.begin(),b.end());
  auto is_b=[](char c){return c=='a'||c=='i'||c=='u'||c=='e'||c=='o';};
  do{
    if(ss.count(b)) continue;
    if(!is_b(b.back())) continue;
    int flg=0;
    for(int i=0;i+1<(int)b.size();i++)
      flg|=!is_b(b[i])&&!is_b(b[i+1]);
    if(flg) continue;
    cout<<b<<endl;
    return 0;
  }while(next_permutation(b.begin(),b.end()));
  
  cout<<"NO"<<endl;
  return 0;
}
0