結果

問題 No.852 連続部分文字列
コンテスト
ユーザー convexineq
提出日時 2021-03-26 05:06:29
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 105 ms / 3,153 ms
+ 318µs
コード長 241 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 82 ms
コンパイル使用メモリ 80,896 KB
実行使用メモリ 182,060 KB
最終ジャッジ日時 2026-09-30 22:00:25
合計ジャッジ時間 5,125 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

*s, = map(ord,input())
n = len(s)
cnt = 26*n*(n+1)//2
res = [-1]*26
for i,si in enumerate(s):
    si -= 97
    cnt -= (i-res[si])*(i-res[si]-1)//2
    res[si] = i
for i in range(26):
    cnt -= (n-res[i])*(n-res[i]-1)//2
print(cnt*2/n/(n+1))
0