結果

問題 No.233 めぐるはめぐる (3)
ユーザー 👑 rin204rin204
提出日時 2022-07-12 14:21:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 293 ms / 1,000 ms
コード長 1,173 bytes
コンパイル時間 569 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 87,540 KB
最終ジャッジ日時 2023-09-05 15:59:44
合計ジャッジ時間 6,492 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 285 ms
87,276 KB
testcase_01 AC 249 ms
87,388 KB
testcase_02 AC 227 ms
87,532 KB
testcase_03 AC 261 ms
87,336 KB
testcase_04 AC 293 ms
87,424 KB
testcase_05 AC 287 ms
87,444 KB
testcase_06 AC 284 ms
87,484 KB
testcase_07 AC 290 ms
87,300 KB
testcase_08 AC 286 ms
87,532 KB
testcase_09 AC 179 ms
87,492 KB
testcase_10 AC 183 ms
87,264 KB
testcase_11 AC 181 ms
87,416 KB
testcase_12 AC 257 ms
87,344 KB
testcase_13 AC 288 ms
87,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
def popcount(x):
    x = x - ((x >> 1) & 0x55555555)
    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f
    x += x >> 8
    x += x >> 16
    return x & 0x0000003f

S = "iaaeuu"
bo = set()
for ss in itertools.permutations(S):
    bo.add("".join(ss))
S = "nbmgr"
shi = set()
for ss in itertools.permutations(S):
    shi.add("".join(ss))
bits = []
for bit in range(1 << 11):
    pc = popcount(bit)
    if pc != 5:
        continue
    if bit >> 10 & 1:
        continue
    ok = True
    for i in range(10):
        if bit >> i & 1 and bit >> (i + 1) & 1:
            ok = False
            break
    if ok:
        bits.append(bit)

se = set()
for S in bo:
    for T in shi:
        for bit in bits:
            X = []
            sp = 0
            tp = 0
            for i in range(11):
                if bit >> i & 1:
                    X.append(T[tp])
                    tp += 1
                else:
                    X.append(S[sp])
                    sp += 1
            se.add("".join(X))

n = int(input())
for _ in range(n):
    S = input()
    se.remove(S)

for s in se:
    print(s)
    exit()
print("NO")
0