結果
| 問題 | 
                            No.233 めぐるはめぐる (3)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2015-06-26 23:29:38 | 
| 言語 | Python2  (2.7.18)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 730 bytes | 
| コンパイル時間 | 125 ms | 
| コンパイル使用メモリ | 7,040 KB | 
| 実行使用メモリ | 21,556 KB | 
| 最終ジャッジ日時 | 2024-07-07 18:32:30 | 
| 合計ジャッジ時間 | 5,573 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 WA * 2 | 
ソースコード
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (ΦωΦ)<どうよ!
from itertools import permutations, product, izip_longest
who = 'inabameguru'
nya = ''.join(who[i] for i in xrange(0, len(who), 2))
nyk = ''.join(who[i] for i in xrange(1, len(who), 2))
nyaa = set(''.join(e) for e in permutations(nya))
nykk = set(''.join(e) for e in permutations(nyk))
sett = set()
for ele in product(nyaa, nykk):
    sett.add(''.join(map(lambda e: ''.join(e), izip_longest(*ele, fillvalue=''))))
for ele in product(nykk, nyaa):
    sett.add(''.join(map(lambda e: ''.join(e), izip_longest(*ele, fillvalue=''))))
n = int(raw_input())
s = set(raw_input() for _ in xrange(n))
sett -= s
if len(sett) > 0:
    print list(sett)[0]
else:
    print 'NO'