結果

問題 No.2715 Unique Chimatagram
ユーザー hato336
提出日時 2024-04-05 21:38:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,958 ms / 2,000 ms
コード長 941 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 81,904 KB
実行使用メモリ 92,032 KB
最終ジャッジ日時 2024-10-01 01:52:44
合計ジャッジ時間 12,046 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
n = int(input())
se = [set() for i in range(n)]
a = []
for i in range(n):
    check = 0
    s = input().rstrip()
    a.append(s)
    for j in s:
        check += pow(12,ord(j) - ord('a'))
    for j in range(26):
        check += pow(12,j)
        se[i].add(check)
        check -= pow(12,j)

for i in range(n):
    for j in se[i]:
        cnt = 0
        for k in range(n):
            if k == i:
                continue
            if len(a[i]) != len(a[k]):
                continue
            if j in se[k]:
                cnt += 1
        if cnt == 0:
            for k in range(26):
                for l in range((j % pow(12,k+1)) // pow(12,k)):
                    print(chr(ord('a') + k),end='')
            print()
            exit()
print(-1)
0