結果

問題 No.233 めぐるはめぐる (3)
ユーザー finefine
提出日時 2017-09-01 18:04:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 120 ms / 1,000 ms
コード長 833 bytes
コンパイル時間 1,638 ms
コンパイル使用メモリ 173,320 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-04-24 09:55:14
合計ジャッジ時間 4,897 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
13,696 KB
testcase_01 AC 106 ms
13,440 KB
testcase_02 AC 74 ms
13,696 KB
testcase_03 AC 102 ms
13,568 KB
testcase_04 AC 112 ms
13,696 KB
testcase_05 AC 116 ms
13,696 KB
testcase_06 AC 113 ms
13,696 KB
testcase_07 AC 120 ms
13,568 KB
testcase_08 AC 115 ms
13,568 KB
testcase_09 AC 49 ms
13,696 KB
testcase_10 AC 52 ms
13,440 KB
testcase_11 AC 51 ms
13,568 KB
testcase_12 AC 98 ms
13,568 KB
testcase_13 AC 120 ms
13,696 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);
	sort(consonant, consonant + 5);
	sort(vowel, vowel + 6);
	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