結果
問題 | No.2021 Not A but B |
ユーザー | H20 |
提出日時 | 2022-07-29 22:11:57 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 269 ms / 2,000 ms |
コード長 | 292 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 82,600 KB |
実行使用メモリ | 114,772 KB |
最終ジャッジ日時 | 2024-07-19 15:02:18 |
合計ジャッジ時間 | 5,507 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
N = int(input()) S = list(input()) mod = 10**9+9 v = 0 for i,s in enumerate(S): if s=='B': v+=pow(2,i,mod) ANS = set() for i in range(N-1): temp = v if S[i]=='A': temp+=pow(2,i,mod) if S[i+1]=='A': temp+=pow(2,i+1,mod) ANS.add(temp) print(len(ANS))