結果

問題 No.233 めぐるはめぐる (3)
ユーザー hirokazu1020hirokazu1020
提出日時 2015-07-25 19:15:52
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 622 ms / 1,000 ms
コード長 1,018 bytes
コンパイル時間 1,069 ms
コンパイル使用メモリ 88,576 KB
実行使用メモリ 7,348 KB
最終ジャッジ日時 2023-09-22 23:08:29
合計ジャッジ時間 5,840 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
6,852 KB
testcase_01 AC 59 ms
5,396 KB
testcase_02 AC 35 ms
4,500 KB
testcase_03 AC 64 ms
5,856 KB
testcase_04 AC 615 ms
7,288 KB
testcase_05 AC 291 ms
7,268 KB
testcase_06 AC 278 ms
7,172 KB
testcase_07 AC 619 ms
7,308 KB
testcase_08 AC 622 ms
7,348 KB
testcase_09 AC 11 ms
4,380 KB
testcase_10 AC 12 ms
4,376 KB
testcase_11 AC 8 ms
4,376 KB
testcase_12 AC 60 ms
5,588 KB
testcase_13 AC 88 ms
6,852 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,idx=0;
	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;
		while(idx<n&&s[idx]<str)idx++;
		if(idx<n&&str==s[idx])ok=false;
		
		if(ok){
			cout<<str<<endl;
			return 0;
		}
	}while(next_permutation(all(str)));
	cout<<"NO"<<endl;
	return 0;
}
0