結果

問題 No.852 連続部分文字列
ユーザー H3PO4H3PO4
提出日時 2021-02-26 09:12:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 888 ms / 3,153 ms
コード長 282 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 90,204 KB
最終ジャッジ日時 2024-04-09 22:27:13
合計ジャッジ時間 12,926 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,624 KB
testcase_01 AC 28 ms
10,624 KB
testcase_02 AC 27 ms
10,624 KB
testcase_03 AC 28 ms
10,624 KB
testcase_04 AC 31 ms
10,624 KB
testcase_05 AC 28 ms
10,624 KB
testcase_06 AC 27 ms
10,624 KB
testcase_07 AC 28 ms
10,624 KB
testcase_08 AC 27 ms
10,624 KB
testcase_09 AC 27 ms
10,624 KB
testcase_10 AC 27 ms
10,752 KB
testcase_11 AC 27 ms
10,752 KB
testcase_12 AC 27 ms
10,624 KB
testcase_13 AC 40 ms
11,904 KB
testcase_14 AC 34 ms
11,264 KB
testcase_15 AC 50 ms
12,800 KB
testcase_16 AC 43 ms
11,904 KB
testcase_17 AC 51 ms
12,288 KB
testcase_18 AC 51 ms
12,928 KB
testcase_19 AC 30 ms
10,880 KB
testcase_20 AC 39 ms
11,648 KB
testcase_21 AC 52 ms
13,056 KB
testcase_22 AC 34 ms
11,392 KB
testcase_23 AC 44 ms
12,160 KB
testcase_24 AC 37 ms
11,520 KB
testcase_25 AC 43 ms
12,160 KB
testcase_26 AC 52 ms
12,928 KB
testcase_27 AC 39 ms
11,904 KB
testcase_28 AC 45 ms
12,416 KB
testcase_29 AC 51 ms
13,184 KB
testcase_30 AC 31 ms
11,008 KB
testcase_31 AC 53 ms
13,056 KB
testcase_32 AC 50 ms
13,184 KB
testcase_33 AC 884 ms
90,044 KB
testcase_34 AC 864 ms
89,988 KB
testcase_35 AC 859 ms
90,016 KB
testcase_36 AC 871 ms
90,044 KB
testcase_37 AC 858 ms
90,136 KB
testcase_38 AC 888 ms
90,204 KB
testcase_39 AC 847 ms
90,044 KB
testcase_40 AC 852 ms
90,036 KB
testcase_41 AC 863 ms
90,048 KB
testcase_42 AC 827 ms
90,096 KB
testcase_43 AC 835 ms
90,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

en2asc = lambda s: ord(s) - 97

S = input()
L = len(S)
cur = [-1] * 26
left = [-1] * L
for i, s in enumerate(S):
    left[i] = cur[en2asc(s)]
    cur[en2asc(s)] = i

dp = [1] * L
for i in range(1, L):
    dp[i] = dp[i - 1] + i - left[i]
ans = sum(dp) * 2 / ((L + 1) * L)
print(ans)
0