結果

問題 No.233 めぐるはめぐる (3)
ユーザー hirokazu1020hirokazu1020
提出日時 2015-07-25 19:11:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 473 ms / 1,000 ms
コード長 970 bytes
コンパイル時間 1,670 ms
コンパイル使用メモリ 88,988 KB
実行使用メモリ 7,244 KB
最終ジャッジ日時 2023-09-22 23:07:48
合計ジャッジ時間 6,482 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
7,120 KB
testcase_01 AC 57 ms
5,656 KB
testcase_02 AC 35 ms
4,472 KB
testcase_03 AC 61 ms
5,916 KB
testcase_04 AC 464 ms
7,244 KB
testcase_05 AC 232 ms
7,216 KB
testcase_06 AC 221 ms
7,212 KB
testcase_07 AC 471 ms
7,164 KB
testcase_08 AC 473 ms
7,216 KB
testcase_09 AC 8 ms
4,376 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 9 ms
4,380 KB
testcase_12 AC 58 ms
5,728 KB
testcase_13 AC 86 ms
6,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<cctype>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define indexOf(v,x) (find(all(v),x)-v.begin())


bool siin(char c){
	return c!='a'&&c!='i'&&c!='u'&&c!='e'&&c!='o';
}

int main(){
	string str("inabameguru");
	int n;
	cin>>n;
	vector<string> s(n);
	rep(i,n)cin>>s[i];
	sort(all(str));
	sort(all(s));
	do{
		bool ok=true;
		rep(i,str.size()-1){
			if(siin(str[i])&&siin(str[i+1]))ok=false;
		}
		if(siin(str[str.size()-1]))ok=false;
		if(ok&&!binary_search(all(s),str)){
			cout<<str<<endl;
			return 0;
		}
	}while(next_permutation(all(str)));
	cout<<"NO"<<endl;
	return 0;
}
0