結果

問題 No.233 めぐるはめぐる (3)
ユーザー H3PO4H3PO4
提出日時 2020-06-02 23:16:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 715 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 41,964 KB
最終ジャッジ日時 2024-05-03 15:22:32
合計ジャッジ時間 23,897 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import sys

input = sys.stdin.readline

N = int(input())
S = set(input() for _ in range(N))

anagrams = set()


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


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(6):
            anagrams.add(make_str(iter(consonant), iter(vowel), dup))

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