結果

問題 No.233 めぐるはめぐる (3)
ユーザー 夜
提出日時 2020-12-10 22:50:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 278 ms / 1,000 ms
コード長 966 bytes
コンパイル時間 983 ms
コンパイル使用メモリ 103,924 KB
実行使用メモリ 13,832 KB
最終ジャッジ日時 2023-10-20 00:57:51
合計ジャッジ時間 5,263 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
13,428 KB
testcase_01 AC 78 ms
10,004 KB
testcase_02 AC 35 ms
6,840 KB
testcase_03 AC 88 ms
10,696 KB
testcase_04 AC 160 ms
13,832 KB
testcase_05 AC 254 ms
13,832 KB
testcase_06 AC 238 ms
13,832 KB
testcase_07 AC 278 ms
13,832 KB
testcase_08 AC 276 ms
13,832 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 75 ms
10,072 KB
testcase_13 AC 135 ms
13,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
set<string> st;
string c[6] = { "","n","b","m","g","r" };
string v[6] = { "i","a","a","e","u","u" };
vector<int> vec = { 0,1,2,3,4,5 }, vec1 = { 0,1,2,3,4,5 };
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		st.insert(s);
	}
	if (st.find("inabameguru") == st.end()) {
		cout << "inabameguru" << endl;
		return 0;
	}
	while (next_permutation(vec.begin(), vec.end())) {
		while (next_permutation(vec1.begin(), vec1.end())) {
			string ans = "";
			for (int i = 0; i < 6; i++) {
				ans += c[vec[i]];
				ans += v[vec1[i]];
			}
			if (st.find(ans) == st.end()) {
				cout << ans << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
}
0