結果
問題 | No.1845 Long Substrings |
ユーザー | umezo |
提出日時 | 2022-02-19 05:06:57 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 600 bytes |
コンパイル時間 | 4,581 ms |
コンパイル使用メモリ | 272,780 KB |
実行使用メモリ | 5,344 KB |
最終ジャッジ日時 | 2023-09-11 20:29:14 |
合計ジャッジ時間 | 7,119 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 1 ms
4,384 KB |
testcase_22 | AC | 2 ms
4,380 KB |
testcase_23 | AC | 1 ms
4,380 KB |
testcase_24 | AC | 2 ms
4,376 KB |
testcase_25 | AC | 2 ms
4,384 KB |
testcase_26 | AC | 1 ms
4,376 KB |
testcase_27 | AC | 2 ms
4,380 KB |
testcase_28 | AC | 1 ms
4,380 KB |
testcase_29 | AC | 2 ms
4,376 KB |
testcase_30 | AC | 1 ms
4,376 KB |
testcase_31 | AC | 2 ms
4,376 KB |
testcase_32 | AC | 2 ms
4,376 KB |
testcase_33 | AC | 1 ms
4,380 KB |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint=modint1000000007; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; vector<ll> A(n); rep(i,n) cin>>A[i]; string s; cin>>s; mint ans=1; map<char,mint> dp; map<ll,mint> dp1; rep(i,n){ mint tmp=ans; ans+=A[i]*(ans-dp1[s[i]]*dp[s[i]]); dp[s[i]]=tmp; dp1[s[i]]=A[i]; } ans-=1; cout<<ans.val()<<endl; return 0; }