結果
| 問題 |
No.2715 Unique Chimatagram
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2024-04-06 16:47:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 101 ms / 2,000 ms |
| コード長 | 555 bytes |
| コンパイル時間 | 410 ms |
| コンパイル使用メモリ | 82,164 KB |
| 実行使用メモリ | 81,908 KB |
| 最終ジャッジ日時 | 2024-10-01 03:54:42 |
| 合計ジャッジ時間 | 5,253 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
import sys
input = sys.stdin.readline
from collections import *
def strsort(s):
s = sorted(s)
return "".join(s)
N = int(input())
D = defaultdict(int)
S = [None] * N
for i in range(N):
S[i] = input().rstrip()
S[i] = strsort(S[i])
for k in range(26):
temp = S[i] + chr(ord("a") + k)
temp = strsort(temp)
D[temp] += 1
for i in range(N):
for k in range(26):
temp = S[i] + chr(ord("a") + k)
temp = strsort(temp)
if D[temp] == 1:
print(temp)
exit()
print(-1)
rlangevin