結果

問題 No.852 連続部分文字列
ユーザー kekurekekure
提出日時 2019-10-15 10:20:59
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 444 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 330,964 KB
最終ジャッジ日時 2023-08-27 05:02:41
合計ジャッジ時間 11,013 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 71 ms
71,072 KB
testcase_02 AC 75 ms
71,012 KB
testcase_03 AC 72 ms
71,036 KB
testcase_04 AC 72 ms
71,016 KB
testcase_05 AC 71 ms
71,092 KB
testcase_06 AC 72 ms
70,916 KB
testcase_07 AC 74 ms
70,780 KB
testcase_08 AC 73 ms
71,076 KB
testcase_09 AC 72 ms
71,160 KB
testcase_10 AC 72 ms
71,168 KB
testcase_11 AC 72 ms
70,940 KB
testcase_12 AC 73 ms
71,172 KB
testcase_13 AC 122 ms
76,328 KB
testcase_14 AC 91 ms
76,192 KB
testcase_15 AC 196 ms
76,856 KB
testcase_16 AC 122 ms
76,448 KB
testcase_17 AC 156 ms
76,324 KB
testcase_18 AC 201 ms
76,376 KB
testcase_19 AC 80 ms
75,756 KB
testcase_20 AC 107 ms
76,444 KB
testcase_21 AC 213 ms
76,624 KB
testcase_22 AC 98 ms
76,196 KB
testcase_23 AC 148 ms
76,372 KB
testcase_24 AC 105 ms
76,220 KB
testcase_25 AC 146 ms
76,348 KB
testcase_26 AC 206 ms
76,372 KB
testcase_27 AC 124 ms
76,456 KB
testcase_28 AC 159 ms
76,508 KB
testcase_29 AC 214 ms
76,452 KB
testcase_30 AC 87 ms
76,420 KB
testcase_31 AC 217 ms
76,396 KB
testcase_32 AC 241 ms
76,520 KB
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
l = len(s)
C = [0] * l #1~l文字までの文字の種類の数
dic ={}
k = 0
for i in range(l):
    if s[i] not in dic:
        dic[s[i]] = 1
        k += 1
    C[i] = k
w = sum(C)
sum_w = w

for i in range(1, l): #i番目から始める部分文字列
    b = s[i - 1] #手前の文字
    n = l - i
    if b in s[i:]:
        n = s[i:].index(b)
    w = w - n - 1
    sum_w += w

n = l * (l + 1) / 2
print(sum_w / n)











0