結果

問題 No.1171 Runs in Subsequences
ユーザー qumazakiqumazaki
提出日時 2020-09-10 20:55:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 76,996 KB
最終ジャッジ日時 2023-08-25 15:36:35
合計ジャッジ時間 5,389 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
70,856 KB
testcase_01 AC 71 ms
71,156 KB
testcase_02 AC 73 ms
71,220 KB
testcase_03 AC 72 ms
71,224 KB
testcase_04 AC 73 ms
71,232 KB
testcase_05 AC 72 ms
70,960 KB
testcase_06 AC 72 ms
71,104 KB
testcase_07 AC 72 ms
70,796 KB
testcase_08 AC 71 ms
70,852 KB
testcase_09 AC 72 ms
71,144 KB
testcase_10 AC 74 ms
71,100 KB
testcase_11 AC 71 ms
71,176 KB
testcase_12 AC 73 ms
71,224 KB
testcase_13 AC 71 ms
70,964 KB
testcase_14 AC 72 ms
70,992 KB
testcase_15 AC 260 ms
76,672 KB
testcase_16 AC 255 ms
76,996 KB
testcase_17 AC 263 ms
76,880 KB
testcase_18 AC 270 ms
76,764 KB
testcase_19 AC 253 ms
76,480 KB
testcase_20 AC 265 ms
76,716 KB
testcase_21 AC 265 ms
76,712 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