結果

問題 No.2715 Unique Chimatagram
ユーザー hato336hato336
提出日時 2024-04-05 21:34:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,213 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 109,496 KB
最終ジャッジ日時 2024-04-05 21:35:14
合計ジャッジ時間 15,589 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
85,176 KB
testcase_01 WA -
testcase_02 AC 108 ms
85,176 KB
testcase_03 AC 119 ms
88,504 KB
testcase_04 AC 119 ms
88,504 KB
testcase_05 AC 138 ms
88,504 KB
testcase_06 AC 140 ms
88,504 KB
testcase_07 AC 117 ms
85,176 KB
testcase_08 AC 187 ms
105,656 KB
testcase_09 WA -
testcase_10 AC 193 ms
107,064 KB
testcase_11 AC 219 ms
107,576 KB
testcase_12 AC 211 ms
106,552 KB
testcase_13 AC 194 ms
107,576 KB
testcase_14 AC 223 ms
105,400 KB
testcase_15 AC 193 ms
106,936 KB
testcase_16 AC 191 ms
105,784 KB
testcase_17 AC 215 ms
106,680 KB
testcase_18 AC 379 ms
109,496 KB
testcase_19 AC 377 ms
109,496 KB
testcase_20 AC 385 ms
109,496 KB
testcase_21 AC 402 ms
109,496 KB
testcase_22 AC 438 ms
109,496 KB
testcase_23 AC 379 ms
109,496 KB
testcase_24 AC 408 ms
109,496 KB
testcase_25 AC 395 ms
109,496 KB
testcase_26 AC 392 ms
109,496 KB
testcase_27 AC 415 ms
109,496 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 113 ms
85,048 KB
testcase_34 AC 115 ms
85,176 KB
testcase_35 AC 124 ms
88,376 KB
testcase_36 AC 118 ms
85,176 KB
testcase_37 AC 127 ms
85,176 KB
testcase_38 AC 143 ms
89,272 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 389 ms
108,088 KB
testcase_42 TLE -
権限があれば一括ダウンロードができます

ソースコード

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
dist = [[10**18 for i in range(n)] for j in range(n)]
for i in range(n):
    for j in range(n):
        if len(a[i]) != len(a[j]):
            continue
        dist[i][j] = 0
        for k in range(len(a[i])):
            dist[i][j] += 1 if a[i][k] != a[j][k] else 0
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]) or dist[i][k] >= 2:
                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