結果
| 問題 | No.1171 Runs in Subsequences |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-11 15:35:16 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 586 bytes |
| 記録 | |
| コンパイル時間 | 1,066 ms |
| コンパイル使用メモリ | 217,100 KB |
| 実行使用メモリ | 16,640 KB |
| 最終ジャッジ日時 | 2026-07-05 15:53:55 |
| 合計ジャッジ時間 | 3,276 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#include<atcoder/modint>
using namespace atcoder;
using mint =modint1000000007;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
string S;
cin>>S;
int N=S.size();
vector<mint> TP(N+1,1);
for(int i=0;i<N;i++)TP[i+1]=TP[i]*2;
vector<mint> P(26,0);
mint an=TP[N]-1;
for(int i=0;i<N;i++){
for(char c='a';c<='z';c++){
if(c==S[i])continue;
an+=P[c-'a']*TP[N-i-1];
}
P[S[i]-'a']+=TP[i];
}
cout<<an.val()<<endl;
}