結果

問題 No.1171 Runs in Subsequences
ユーザー WSKRWSKR
提出日時 2020-09-22 21:20:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 839 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 8,464 KB
最終ジャッジ日時 2023-09-09 03:45:52
合計ジャッジ時間 7,257 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,964 KB
testcase_01 AC 17 ms
7,912 KB
testcase_02 AC 15 ms
7,808 KB
testcase_03 AC 15 ms
7,840 KB
testcase_04 AC 15 ms
7,768 KB
testcase_05 AC 16 ms
7,960 KB
testcase_06 AC 16 ms
7,828 KB
testcase_07 AC 15 ms
7,864 KB
testcase_08 AC 15 ms
7,916 KB
testcase_09 AC 15 ms
7,836 KB
testcase_10 AC 18 ms
7,908 KB
testcase_11 AC 18 ms
7,960 KB
testcase_12 AC 18 ms
7,864 KB
testcase_13 AC 18 ms
7,808 KB
testcase_14 AC 18 ms
7,852 KB
testcase_15 AC 794 ms
8,316 KB
testcase_16 AC 798 ms
8,388 KB
testcase_17 AC 839 ms
8,260 KB
testcase_18 AC 828 ms
8,464 KB
testcase_19 AC 818 ms
8,264 KB
testcase_20 AC 832 ms
8,332 KB
testcase_21 AC 824 ms
8,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
mod = 10**9+7

n = len(s)
rem = dict()
ans = n* pow(2,n-1,mod)
ans %= mod
for i,si in enumerate(s):
    if(not si in rem):
        rem[si] = 0
    ans -= rem[si] * pow(2,n-i-1,mod)
    ans %= mod
    rem[si] += pow(2,i,mod)
    rem[si] %= mod
print(ans)
0