結果
| 問題 |
No.2715 Unique Chimatagram
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-05 22:42:07 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 610 bytes |
| コンパイル時間 | 522 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-10-01 02:48:54 |
| 合計ジャッジ時間 | 3,615 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 WA * 4 |
ソースコード
n = int(input())
s = []
for i in range(n):
s.append(''.join(sorted(input())))
s.sort()
d = {}
for si in s:
if si in d:
d[si] = False
else:
d[si] = True
s = []
for key in d:
if d[key]:
s.append(key)
if len(s) == 0: print(-1)
elif len(s) == 1:
print(s[0] + "a")
else:
f = True
for i in range(len(s)-1):
a, b = s[i], s[i+1]
if a == b: continue
if len(a) < len(b):
print(a + "a")
else:
for j in range(len(a)):
if a[j] != b[j]:
for c in "abcdefghijklmnopqrstuvwxyz":
if c != a[j] and c != b[j]:
print(a+c)
break
break
f = False
break
if f: print(-1)