結果

問題 No.1171 Runs in Subsequences
ユーザー H3PO4
提出日時 2021-11-03 08:24:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 344 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 17,444 KB
最終ジャッジ日時 2024-10-12 20:07:06
合計ジャッジ時間 4,789 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 TLE * 1 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

en2asc = lambda s: ord(s) - 97

S = input()
MOD = 10 ** 9 + 7
ct = [0] * 26
run = [0] * 26
p2 = 1
for s in S:
    i = en2asc(s)
    ct[i] += p2
    ct[i] %= MOD
    p2 *= 2

    run[i] *= 2
    run[i] += 1
    for j in range(26):
        if i == j:
            continue
        run[i] += run[j] + ct[j]
    run[i] %= MOD

print(sum(run) % MOD)
0