結果
問題 |
No.1171 Runs in Subsequences
|
ユーザー |
![]() |
提出日時 | 2020-08-14 23:08:42 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 333 bytes |
コンパイル時間 | 316 ms |
コンパイル使用メモリ | 82,248 KB |
実行使用メモリ | 109,372 KB |
最終ジャッジ日時 | 2024-10-10 16:35:30 |
合計ジャッジ時間 | 4,643 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 11 TLE * 1 -- * 6 |
ソースコード
import sys input = sys.stdin.readline S=input().strip() mod=10**9+7 L=[] for s in S: L.append(ord(s)-97) ANS=0 ALIST=[0]*26 LEN=len(L) SUM=0 for i in range(LEN): ANS=ANS+(1+SUM-ALIST[L[i]])*pow(2,LEN-i-1,mod) ANS%=mod #print(ANS) ALIST[L[i]],SUM=ALIST[L[i]]+(1+SUM),SUM+1+SUM #print(ALIST) print(ANS)