結果

問題 No.233 めぐるはめぐる (3)
ユーザー IL_mstaIL_msta
提出日時 2015-06-27 02:10:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,838 bytes
コンパイル時間 840 ms
コンパイル使用メモリ 95,144 KB
実行使用メモリ 17,568 KB
最終ジャッジ日時 2023-09-22 03:04:19
合計ジャッジ時間 4,864 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
17,136 KB
testcase_01 AC 63 ms
13,740 KB
testcase_02 AC 28 ms
10,592 KB
testcase_03 AC 72 ms
14,472 KB
testcase_04 AC 136 ms
17,568 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 5 ms
7,432 KB
testcase_08 AC 5 ms
7,528 KB
testcase_09 AC 5 ms
7,616 KB
testcase_10 AC 5 ms
7,480 KB
testcase_11 AC 5 ms
7,408 KB
testcase_12 AC 67 ms
13,824 KB
testcase_13 AC 121 ms
17,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>

#include <algorithm>
#include <cmath>

#include <string>
#include <list>
#include <queue>
#include <vector>
#include <complex>
#include <set>

/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
const int inmax = (518400/4);
string name[inmax];
set<string> nameSet;
int main(void){
    std::cin.tie(0); 
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed;//
    //cout << setprecision(6);//
	//1母音どこでもいいああ
	LL N;
	cin>>N;
	if(N>=inmax){
		P("NO");
		return 0;
	}
	else if(N==0){
		P("inabameguru");
		return 0;
	}
	rep(i,N){
		cin>>name[i];
		nameSet.insert(name[i]);
	}
	///////////////
	
	vector<char> si;
	si.push_back('n');
	si.push_back('b');
	si.push_back('m');
	si.push_back('g');
	si.push_back('r');

	vector<char> bo;
	bo.push_back('a');
	bo.push_back('a');
	bo.push_back('i');
	bo.push_back('u');
	bo.push_back('u');
	bo.push_back('e');

	string temp;
	int count;
	pair<set<string>::iterator,bool> kekka;
	do{
		do{
			for(int k=0;k<6;++k){
				for(int i=0;i<5;++i){
					if(i==k){
						temp += (bo[5]);
					}
					temp += (si[i]);
					temp += (bo[i]);
				}
				if(k==5){
					temp += (bo[5]);
				}
				kekka = nameSet.insert(temp);
				if(kekka.second == true){
					P( *(kekka.first) );
					return 0;
				}
				/*
				count = 0;
				for(int i=0;i<N;++i){//129600
					if(temp != name[i] ){
						++count;
					}else{
						break;
					}
				}
				if(count == N){
					//P(temp);
//					return 0;
				}
				*/
				temp = "";
			}
		}while( next_permutation(bo.begin(), bo.end()) );
	}while( next_permutation(si.begin(), si.end()) );
	P("NO");
	return 0;
}
0