結果

問題 No.233 めぐるはめぐる (3)
ユーザー ciel
提出日時 2015-06-27 00:04:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 91 ms / 1,000 ms
コード長 566 bytes
コンパイル時間 731 ms
コンパイル使用メモリ 78,144 KB
実行使用メモリ 12,644 KB
最終ジャッジ日時 2024-07-07 19:26:57
合計ジャッジ時間 3,269 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <unordered_set>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int N;
	unordered_set<string>se;
	for(cin>>N;N--;){
		string s;
		cin>>s;
		se.insert(s);
	}
	vector<char> x={0,'b','g','m','n','r'},y={'a','a','e','i','u','u'};
	do{
		do{
			string s;
			for(int i=0;i<6;i++){
				if(x[i])s+=x[i];
				s+=y[i];
			}
			if(se.find(s)==se.end()){
				cout<<s<<endl;
				return 0;
			}
		}while(next_permutation(y.begin(),y.end()));
	}while(next_permutation(x.begin(),x.end()));
	cout<<"NO"<<endl;
}
0