結果

問題 No.852 連続部分文字列
ユーザー vwxyzvwxyz
提出日時 2024-04-08 05:51:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,575 ms / 3,153 ms
コード長 295 bytes
コンパイル時間 2,451 ms
コンパイル使用メモリ 81,444 KB
実行使用メモリ 84,688 KB
最終ジャッジ日時 2024-04-08 05:52:02
合計ジャッジ時間 27,207 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 34 ms
53,460 KB
testcase_04 AC 35 ms
53,460 KB
testcase_05 AC 41 ms
59,472 KB
testcase_06 AC 39 ms
59,088 KB
testcase_07 AC 40 ms
59,472 KB
testcase_08 AC 54 ms
53,460 KB
testcase_09 AC 34 ms
53,460 KB
testcase_10 AC 45 ms
59,088 KB
testcase_11 AC 51 ms
53,460 KB
testcase_12 AC 47 ms
59,088 KB
testcase_13 AC 76 ms
75,744 KB
testcase_14 AC 62 ms
75,612 KB
testcase_15 AC 93 ms
75,828 KB
testcase_16 AC 75 ms
75,740 KB
testcase_17 AC 91 ms
75,796 KB
testcase_18 AC 95 ms
75,844 KB
testcase_19 AC 51 ms
68,572 KB
testcase_20 AC 70 ms
75,612 KB
testcase_21 AC 95 ms
75,852 KB
testcase_22 AC 77 ms
75,612 KB
testcase_23 AC 81 ms
75,772 KB
testcase_24 AC 67 ms
75,612 KB
testcase_25 AC 80 ms
75,768 KB
testcase_26 AC 93 ms
75,844 KB
testcase_27 AC 76 ms
75,748 KB
testcase_28 AC 84 ms
75,796 KB
testcase_29 AC 108 ms
75,852 KB
testcase_30 AC 59 ms
75,612 KB
testcase_31 AC 94 ms
75,860 KB
testcase_32 AC 97 ms
75,868 KB
testcase_33 AC 1,556 ms
84,428 KB
testcase_34 AC 1,575 ms
84,688 KB
testcase_35 AC 1,525 ms
84,684 KB
testcase_36 AC 1,538 ms
84,428 KB
testcase_37 AC 1,503 ms
84,432 KB
testcase_38 AC 1,541 ms
84,428 KB
testcase_39 AC 1,531 ms
84,428 KB
testcase_40 AC 1,533 ms
84,560 KB
testcase_41 AC 1,512 ms
84,428 KB
testcase_42 AC 934 ms
84,428 KB
testcase_43 AC 942 ms
84,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0