結果
| 問題 |
No.852 連続部分文字列
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2025-01-12 20:42:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 291 bytes |
| コンパイル時間 | 661 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 76,800 KB |
| 最終ジャッジ日時 | 2025-01-12 20:42:26 |
| 合計ジャッジ時間 | 11,650 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 30 OLE * 11 |
ソースコード
from collections import defaultdict
dic = defaultdict(int)
S = input()
N = len(S)
ans = 0
tmp1 = 0
for i, s in enumerate(S):
x = 0
if s in dic:
x = dic[s]
tmp1 += (i - x + 1)
ans += tmp1
print(ans, tmp1)
dic[s] = i + 1
ans *= 2
ans /= N * (N + 1)
print(ans)
ntuda