結果

問題 No.2715 Unique Chimatagram
ユーザー june19312
提出日時 2024-04-05 21:36:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 810 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 82,232 KB
実行使用メモリ 81,416 KB
最終ジャッジ日時 2024-10-01 01:49:59
合計ジャッジ時間 5,528 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

dic = {}
dic2 = {}
abc = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(N):
    S = list(input())
    S.sort()
    nex = "".join(S)
    
    if nex in dic:
        dic[nex] += 1
    else:
        dic[nex] = 1
        for j in abc:
            nex2 = S + [j]
            nex2.sort()
            nex3 = "".join(nex2)
            if nex3 not in dic2:
                dic2[nex3] = 1
            else:
                dic2[nex3] += 1

#print(dic)
#print(dic2)

for ind,val in dic.items():
    if val == 1:
        for j in abc:
            nex2 = S + [j]
            nex2.sort()
            nex3 = "".join(nex2)
            if nex3 in dic2 and dic2[nex3] == 1:
                print(nex3)
                exit()
print(-1)

0