結果

問題 No.233 めぐるはめぐる (3)
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-02-29 01:07:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,216 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 69,116 KB
実行使用メモリ 5,352 KB
最終ジャッジ日時 2023-10-24 18:58:03
合計ジャッジ時間 4,723 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
5,340 KB
testcase_01 AC 87 ms
5,344 KB
testcase_02 AC 67 ms
5,344 KB
testcase_03 AC 92 ms
5,344 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 46 ms
5,344 KB
testcase_10 AC 45 ms
5,344 KB
testcase_11 AC 47 ms
5,344 KB
testcase_12 AC 88 ms
5,344 KB
testcase_13 AC 110 ms
5,340 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(i==j) setin+=in;
			setin+=s[j];
		}
		if(i==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);
	}

	cout<<*(name.begin())<<endl;
}
0