結果

問題 No.2715 Unique Chimatagram
ユーザー hato336
提出日時 2024-04-05 21:39:36
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,019 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 92,260 KB
最終ジャッジ日時 2024-10-01 01:54:11
合計ジャッジ時間 13,708 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
t = time.time()
#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]:
        if time.time() - t > 1.9:
            exit(print(-1))
        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