結果
| 問題 | 
                            No.233 めぐるはめぐる (3)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-03-02 22:34:31 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 281 ms / 1,000 ms | 
| コード長 | 465 bytes | 
| コンパイル時間 | 304 ms | 
| コンパイル使用メモリ | 82,328 KB | 
| 実行使用メモリ | 95,604 KB | 
| 最終ジャッジ日時 | 2024-09-24 13:37:06 | 
| 合計ジャッジ時間 | 6,089 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 | 
ソースコード
#!/usr/bin/python3
from itertools import permutations, product
who = 'inabameguru'
m = len(who)
vow = set(map(''.join, permutations(who[::2])))
con = set(map(''.join, permutations(who[1::2])))
sett = set()
for p, q in product(con, vow):
    x = ''.join(map(''.join, zip(p, q[:-1])))
    for i in range(m):
        sett.add(x[:i] + q[-1] + x[i:])
n = int(input())
s = set(input() for _ in range(n))
sett -= s
res = 'NO'
if len(sett):
    res = sett.pop()
print(res)