結果
| 問題 |
No.852 連続部分文字列
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-04-08 05:28:19 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 295 bytes |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 28,168 KB |
| 最終ジャッジ日時 | 2024-10-01 04:51:25 |
| 合計ジャッジ時間 | 12,963 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 TLE * 1 -- * 10 |
ソースコード
S=[ord(s)-97 for s in input()]
prev=[-1]*26
N=len(S)
ans=0
for i in range(N):
prev[S[i]]=i
bound=[prev[s]+1 for s in range(26) if prev[s]!=-1]+[0]
bound.sort(reverse=True)
cnt=0
for r,l in zip(bound,bound[1:]):
cnt+=1
ans+=cnt*(r-l)
ans/=N*(N+1)//2
print(ans)
vwxyz