結果

問題 No.233 めぐるはめぐる (3)
ユーザー suzuishisuzuishi
提出日時 2022-04-17 22:02:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 545 ms / 1,000 ms
コード長 2,043 bytes
コンパイル時間 2,551 ms
コンパイル使用メモリ 181,556 KB
実行使用メモリ 13,628 KB
最終ジャッジ日時 2023-08-27 03:56:21
合計ジャッジ時間 8,012 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
13,068 KB
testcase_01 AC 64 ms
9,792 KB
testcase_02 AC 32 ms
6,684 KB
testcase_03 AC 68 ms
10,344 KB
testcase_04 AC 532 ms
13,628 KB
testcase_05 AC 275 ms
13,556 KB
testcase_06 AC 265 ms
13,580 KB
testcase_07 AC 545 ms
13,572 KB
testcase_08 AC 531 ms
13,552 KB
testcase_09 AC 9 ms
4,376 KB
testcase_10 AC 9 ms
4,376 KB
testcase_11 AC 9 ms
4,376 KB
testcase_12 AC 62 ms
9,756 KB
testcase_13 AC 107 ms
13,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 35/40
#include <bits/stdc++.h>
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) a.begin(),a.end()
#define PB(a) push_back(a)
#define FS first
#define SD second
#define SEP(i,n) (i==n-1?'\n':' ')
#define PUTNUM(a,b,c) (a==b?c:a)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using VI=vector<int>;
using VVI=vector<VI>;
using VVVI=vector<VVI>;
using VL=vector<ll>;
using VVL=vector<VL>;
using VVVL=vector<VVL>;
using VB=vector<bool>;
using VVB=vector<VB>;
using VP=vector<P>;
using VVP=vector<VP>;
using VS=vector<string>;
const int dx[]={0,-1,1,0},dy[]={-1,0,0,1};
//const int dx[]={-1,0,1,-1,1,-1,0,1},dy[]={-1,-1,-1,0,0,1,1,1};
template<typename T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T>T eucld(T a,T b){if(a<b)swap(a,b);while(a%b){T q=a%b;a=b;b=q;}return b;}
ll modpow(ll a,ll k,ll m=MOD){a%=m;if(a==0)return 0;ll r=1;while(k>0){if(k&1)r=r*a%m;a=a*a%m;k>>=1;}return r;}
struct UnionFind{VI v;UnionFind(int n):v(n){rep(i,n)v[i]=i;}int root(int x){if(v[x]==x)return x;return v[x]=root(v[x]);}void unite(int x,int y){int a=root(x),b=root(y);if(a!=b)v[a]=b;}bool same(int x,int y){return root(x)==root(y);}};

int main(void) {
   cin.tie(0);
   ios::sync_with_stdio(0);
   cout << fixed << setprecision(7);
   int n; cin >> n;
   set<string> s;
   rep(i,n) {
      string si; cin >> si;
      s.insert(si);
   }
   string t="inabameguru";
   sort(ALL(t));
   set<char> v;
   v.insert('a');
   v.insert('i');
   v.insert('u');
   v.insert('e');
   do {
      rep(i,t.size()-1) {
         if(v.count(t[i])==0 && v.count(t[i+1])==0) goto next_loop;
      }
      if(!v.count(t.back())) goto next_loop;
      if(!s.count(t)) {
         cout << t << endl;
         return 0;
      }
next_loop:
      NULL;
   } while (next_permutation(ALL(t)));
   cout << "NO" << endl;
   return 0;
}
0