結果

問題 No.233 めぐるはめぐる (3)
ユーザー finefine
提出日時 2017-09-01 18:00:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 775 bytes
コンパイル時間 1,877 ms
コンパイル使用メモリ 171,652 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-04-24 09:55:06
合計ジャッジ時間 5,516 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
7,424 KB
testcase_01 AC 49 ms
7,168 KB
testcase_02 AC 35 ms
7,424 KB
testcase_03 AC 50 ms
7,296 KB
testcase_04 AC 63 ms
7,296 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 57 ms
7,296 KB
testcase_08 AC 64 ms
7,296 KB
testcase_09 AC 21 ms
7,424 KB
testcase_10 AC 20 ms
7,424 KB
testcase_11 AC 20 ms
7,168 KB
testcase_12 AC 49 ms
7,424 KB
testcase_13 AC 60 ms
7,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

char consonant[] = {'n', 'b', 'm', 'g', 'r'};
char vowel[] = {'i', 'a', 'a', 'e', 'u', 'u'};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	set<string> candidate;
	do {
		do {
			string s[6] = {};
			for (int i = 0; i < 5; i++) {
				s[i] += vowel[5];
				for (int j = 0; j < 6; j++) {
					s[j] += consonant[i];
					s[j] += vowel[i];
				}
			}
			s[5] += vowel[5];
			for (int i = 0; i < 6; i++) {
				candidate.insert(s[i]);
			}
		} while (next_permutation(vowel, vowel + 6));
	} while (next_permutation(consonant, consonant + 5));

	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		candidate.erase(s);
	}

	cout << (candidate.empty() ? "NO" : *candidate.begin()) << endl;
	return 0;
}
0