結果

問題 No.233 めぐるはめぐる (3)
ユーザー H3PO4H3PO4
提出日時 2020-06-02 22:56:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 97,536 KB
最終ジャッジ日時 2024-05-03 14:52:44
合計ジャッジ時間 11,146 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 446 ms
97,152 KB
testcase_02 AC 450 ms
97,376 KB
testcase_03 AC 442 ms
97,024 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 453 ms
96,896 KB
testcase_10 AC 446 ms
97,280 KB
testcase_11 RE -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N = int(input())
S = set(input().split())

anagrams = set()


def make_str(consonant, vowel, dup):
    lst = [''] * 11
    dup_flag = True
    for i in range(11):
        if dup * 2 <= i:
            dup_flag = False
        if dup_flag ^ (i % 2):
            lst[i] = next(consonant)
        else:
            lst[i] = next(vowel)

    return ''.join(map(str, lst))


for consonant in itertools.permutations(('n', 'b', 'm', 'g', 'r')):
    for vowel in itertools.permutations(('i', 'a', 'a', 'e', 'u', 'u')):
        for dup in range(5):
            anagrams.add(make_str(iter(consonant), iter(vowel), dup))

if N == len(anagrams):
    print('NO')
else:
    print((anagrams - S).pop())
0