結果

問題 No.1171 Runs in Subsequences
ユーザー H3PO4H3PO4
提出日時 2021-11-03 08:24:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 344 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,076 KB
最終ジャッジ日時 2024-04-20 21:51:42
合計ジャッジ時間 4,545 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
16,000 KB
testcase_01 AC 28 ms
10,496 KB
testcase_02 AC 28 ms
10,624 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 29 ms
10,624 KB
testcase_05 AC 27 ms
10,496 KB
testcase_06 AC 27 ms
10,752 KB
testcase_07 AC 27 ms
10,624 KB
testcase_08 AC 27 ms
10,624 KB
testcase_09 AC 27 ms
10,624 KB
testcase_10 AC 35 ms
10,752 KB
testcase_11 AC 34 ms
10,624 KB
testcase_12 AC 34 ms
10,624 KB
testcase_13 AC 35 ms
10,624 KB
testcase_14 AC 38 ms
10,624 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

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