結果
| 問題 |
No.2715 Unique Chimatagram
|
| コンテスト | |
| ユーザー |
june19312
|
| 提出日時 | 2024-04-05 21:43:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 2,000 ms |
| コード長 | 815 bytes |
| コンパイル時間 | 373 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 81,440 KB |
| 最終ジャッジ日時 | 2024-10-01 01:57:37 |
| 合計ジャッジ時間 | 4,868 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
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 = list(ind) + [j]
nex2.sort()
nex3 = "".join(nex2)
if nex3 in dic2 and dic2[nex3] == 1:
print(nex3)
exit()
print(-1)
june19312