結果

問題 No.852 連続部分文字列
ユーザー titiatitia
提出日時 2019-07-27 00:04:21
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 374 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 406,668 KB
最終ジャッジ日時 2023-09-15 05:12:18
合計ジャッジ時間 26,252 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,364 KB
testcase_01 AC 73 ms
71,260 KB
testcase_02 AC 74 ms
71,364 KB
testcase_03 AC 74 ms
71,196 KB
testcase_04 AC 75 ms
71,084 KB
testcase_05 AC 86 ms
76,600 KB
testcase_06 AC 82 ms
76,480 KB
testcase_07 AC 83 ms
76,584 KB
testcase_08 AC 75 ms
71,336 KB
testcase_09 AC 74 ms
71,368 KB
testcase_10 AC 82 ms
76,568 KB
testcase_11 AC 75 ms
71,092 KB
testcase_12 AC 85 ms
76,584 KB
testcase_13 AC 123 ms
80,532 KB
testcase_14 AC 107 ms
78,600 KB
testcase_15 AC 143 ms
88,536 KB
testcase_16 AC 121 ms
80,444 KB
testcase_17 AC 133 ms
86,584 KB
testcase_18 AC 148 ms
89,296 KB
testcase_19 AC 90 ms
76,668 KB
testcase_20 AC 115 ms
79,888 KB
testcase_21 AC 148 ms
89,528 KB
testcase_22 AC 108 ms
79,200 KB
testcase_23 AC 129 ms
85,404 KB
testcase_24 AC 111 ms
79,412 KB
testcase_25 AC 128 ms
85,092 KB
testcase_26 AC 145 ms
88,924 KB
testcase_27 AC 123 ms
84,228 KB
testcase_28 AC 139 ms
86,780 KB
testcase_29 AC 148 ms
89,444 KB
testcase_30 AC 100 ms
78,140 KB
testcase_31 AC 152 ms
89,884 KB
testcase_32 AC 152 ms
90,308 KB
testcase_33 MLE -
testcase_34 MLE -
testcase_35 MLE -
testcase_36 MLE -
testcase_37 MLE -
testcase_38 MLE -
testcase_39 MLE -
testcase_40 MLE -
testcase_41 MLE -
testcase_42 MLE -
testcase_43 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
L=len(S)

M=[[float("inf")]*(L+1) for i in range(26)]

for i in range(L-1,-1,-1):
    for j in range(26):
        if ord(S[i])-97==j:
            M[j][i]=i
        else:
            M[j][i]=M[j][i+1]

ANS=0

for j in range(26):
    for i in range(L):
        k=M[j][i]-i
        if k==float("inf"):
            continue
        ANS+=(L-i)-k

print(ANS/(L*(L+1)/2))
0