結果

問題 No.2715 Unique Chimatagram
ユーザー hato336
提出日時 2024-04-05 21:31:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 928 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 100,744 KB
最終ジャッジ日時 2024-10-01 01:45:45
合計ジャッジ時間 12,526 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

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 for j in range(26)]
    s = input().rstrip()
    a.append(s)
    for j in s:
        check[ord(j) - ord('a')] += 1
    for j in range(26):
        check[j] += 1
        se[i].add(tuple(check))
        check[j] -= 1

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[k]):
                    print(chr(ord('a') + k),end='')
            print()
            exit()
print(-1)
0