結果

問題 No.2715 Unique Chimatagram
ユーザー titiatitia
提出日時 2024-04-05 22:18:11
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 877 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 83,692 KB
最終ジャッジ日時 2024-04-05 22:18:22
合計ジャッジ時間 9,935 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
62,408 KB
testcase_01 AC 45 ms
55,604 KB
testcase_02 AC 48 ms
61,932 KB
testcase_03 AC 42 ms
55,604 KB
testcase_04 AC 42 ms
55,604 KB
testcase_05 AC 43 ms
55,604 KB
testcase_06 AC 42 ms
55,604 KB
testcase_07 AC 41 ms
55,604 KB
testcase_08 AC 86 ms
76,896 KB
testcase_09 AC 99 ms
77,284 KB
testcase_10 AC 83 ms
77,016 KB
testcase_11 AC 91 ms
77,032 KB
testcase_12 AC 86 ms
76,900 KB
testcase_13 AC 88 ms
77,016 KB
testcase_14 AC 111 ms
77,160 KB
testcase_15 AC 99 ms
77,140 KB
testcase_16 AC 82 ms
76,888 KB
testcase_17 AC 82 ms
77,016 KB
testcase_18 AC 88 ms
77,516 KB
testcase_19 AC 85 ms
77,516 KB
testcase_20 AC 90 ms
77,392 KB
testcase_21 AC 89 ms
77,528 KB
testcase_22 AC 96 ms
77,528 KB
testcase_23 AC 89 ms
77,520 KB
testcase_24 AC 88 ms
77,532 KB
testcase_25 AC 86 ms
77,528 KB
testcase_26 AC 85 ms
77,516 KB
testcase_27 AC 87 ms
77,528 KB
testcase_28 AC 487 ms
77,400 KB
testcase_29 AC 234 ms
77,400 KB
testcase_30 AC 329 ms
77,400 KB
testcase_31 AC 119 ms
77,016 KB
testcase_32 AC 1,135 ms
77,528 KB
testcase_33 AC 42 ms
55,604 KB
testcase_34 AC 40 ms
55,604 KB
testcase_35 AC 41 ms
55,604 KB
testcase_36 AC 41 ms
55,604 KB
testcase_37 AC 40 ms
55,604 KB
testcase_38 AC 64 ms
72,392 KB
testcase_39 TLE -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from collections import Counter

n=int(input())
S=[sorted(input().strip()) for i in range(n)]
CS=[]
for i in range(n):
    CS.append(Counter(S[i]))

for i in range(n):
    if i+1<n and S[i]==S[i+1]:
        continue
    if i-1>=0 and S[i]==S[i-1]:
        continue

    for x in "abcdefghijklmnopqrstuvwxyz":
        T=S[i]+[x]
        C=Counter(T)
        flag=1

        for j in range(n):
            if i==j:
                continue

            count=0
            fflag=1

            for y in "abcdefghijklmnopqrstuvwxyz":
                if C[y]<CS[j][y]:
                    fflag=0
                else:
                    count+=C[y]-CS[j][y]

            if fflag==1 and count==1:
                flag=0
                break

        if flag==1:
            print("".join(T))
            exit()
        
        
print(-1)
0