結果

問題 No.1171 Runs in Subsequences
ユーザー H3PO4H3PO4
提出日時 2021-11-03 08:25:01
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 343 bytes
コンパイル時間 1,414 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 81,664 KB
最終ジャッジ日時 2024-04-20 21:51:52
合計ジャッジ時間 4,560 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
57,216 KB
testcase_01 AC 36 ms
51,712 KB
testcase_02 AC 35 ms
52,096 KB
testcase_03 AC 36 ms
52,096 KB
testcase_04 AC 36 ms
51,584 KB
testcase_05 AC 35 ms
51,840 KB
testcase_06 AC 37 ms
51,712 KB
testcase_07 AC 38 ms
52,224 KB
testcase_08 AC 39 ms
52,224 KB
testcase_09 AC 38 ms
51,968 KB
testcase_10 AC 52 ms
62,336 KB
testcase_11 AC 47 ms
61,952 KB
testcase_12 AC 49 ms
62,080 KB
testcase_13 AC 50 ms
62,464 KB
testcase_14 AC 51 ms
61,952 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