結果

問題 No.233 めぐるはめぐる (3)
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-02-29 01:15:50
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 239 ms / 1,000 ms
コード長 1,260 bytes
コンパイル時間 974 ms
コンパイル使用メモリ 69,156 KB
実行使用メモリ 13,740 KB
最終ジャッジ日時 2023-10-24 18:58:42
合計ジャッジ時間 5,814 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 231 ms
13,736 KB
testcase_01 AC 187 ms
13,740 KB
testcase_02 AC 136 ms
13,740 KB
testcase_03 AC 195 ms
13,740 KB
testcase_04 AC 231 ms
13,736 KB
testcase_05 AC 230 ms
13,736 KB
testcase_06 AC 230 ms
13,736 KB
testcase_07 AC 229 ms
13,736 KB
testcase_08 AC 229 ms
13,736 KB
testcase_09 AC 85 ms
13,740 KB
testcase_10 AC 85 ms
13,740 KB
testcase_11 AC 85 ms
13,740 KB
testcase_12 AC 186 ms
13,740 KB
testcase_13 AC 239 ms
13,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<set>

using namespace std;

void make1(string s);
void make2(string s);
void make3(string s);

set<string> name;
int n=0,a=0,b=0,m=0,e=0,g=0,u=0,r=0,i=0;

void make3(string s){
	string in="";
	if(i!=1) in="i";
	else if(a!=2) in="a";
	else if(u!=2) in="u";
	else if(e!=1) in="e";
	for(int ii=0;ii<s.size()+1;ii++){
		string setin="";
		int j;
		for(j=0;j<s.size();j++){
			if(ii==j) setin+=in;
			setin+=s[j];
		}
		if(ii==j) setin+=in;
		name.insert(setin);
	}

}

void make2(string s){
	if(s.size()!=10){
		if(a!=2){
			a++;
			make1(s+'a');
			a--;
		}
		if(i!=1){
			i++;
			make1(s+'i');
			i--;
		}
		if(e!=1){
			e++;
			make1(s+'e');
			e--;
		}
		if(u!=2){
			u++;
			make1(s+'u');
			u--;
		}
	}
	else make3(s);
}

void make1(string s){
	if(s.size()!=10){
		if(n!=1){
			n++;
			make2(s+'n');
			n--;
		}
		if(b!=1){
			b++;
			make2(s+'b');
			b--;
		}
		if(m!=1){
			m++;
			make2(s+'m');
			m--;
		}
		if(g!=1){
			g++;
			make2(s+'g');
			g--;
		}
		if(r!=1){
			r++;
			make2(s+'r');
			r--;
		}
	}
	else make3(s);
}

int main(){

	int N;
	string s;

	make1("");

	cin>>N;

	for(int i=0;i<N;i++){
		cin>>s;
		name.erase(s);
	}

	if(name.size()>0) cout<<*(name.begin())<<endl;
	else cout<<"NO"<<endl;
}
0