結果

問題 No.233 めぐるはめぐる (3)
ユーザー 沙耶花沙耶花
提出日時 2021-11-18 20:06:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 185 ms / 1,000 ms
コード長 808 bytes
コンパイル時間 4,731 ms
コンパイル使用メモリ 268,412 KB
実行使用メモリ 13,576 KB
最終ジャッジ日時 2023-08-27 12:20:10
合計ジャッジ時間 8,474 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
13,096 KB
testcase_01 AC 73 ms
9,808 KB
testcase_02 AC 33 ms
6,652 KB
testcase_03 AC 86 ms
10,432 KB
testcase_04 AC 183 ms
13,512 KB
testcase_05 AC 156 ms
13,460 KB
testcase_06 AC 148 ms
13,532 KB
testcase_07 AC 185 ms
13,576 KB
testcase_08 AC 185 ms
13,512 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 74 ms
9,856 KB
testcase_13 AC 134 ms
13,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001



int main(){
	
	string bo = "iaaeuu";
	string si = "nbmgr";
	
	sort(bo.begin(),bo.end());
	sort(si.begin(),si.end());
	
	int n;
	cin>>n;
	
	set<string> s;
	rep(i,n){
		string t;
		cin>>t;
		s.insert(t);
	}
	
	do{
		sort(si.begin(),si.end());
		do{
			string t = "";
			rep(i,5){
				t += si[i];
				t += bo[i];
			}
			rep(i,6){
				string tt = t;
				tt.insert(tt.begin()+i*2,bo.back());
				if(s.count(tt))continue;
				cout<<tt<<endl;
				return 0;
			}
		}
		while(next_permutation(si.begin(),si.end()));
	}while(next_permutation(bo.begin(),bo.end()));
	
	cout<<"NO"<<endl;
	
	return 0;
}
0