結果
| 問題 |
No.1845 Long Substrings
|
| コンテスト | |
| ユーザー |
👑 tatyam
|
| 提出日時 | 2021-12-22 11:24:49 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 683 bytes |
| コンパイル時間 | 3,741 ms |
| コンパイル使用メモリ | 269,944 KB |
| 実行使用メモリ | 20,664 KB |
| 最終ジャッジ日時 | 2024-09-16 16:45:52 |
| 合計ジャッジ時間 | 8,763 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 12 RE * 20 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/string>
#include <atcoder/modint>
using namespace std;
using Modint = atcoder::modint1000000007;
Modint solve(string s){
auto sa = atcoder::suffix_array(s);
Modint ans = s.size() * (s.size() + 1) / 2;
for(auto i : atcoder::lcp_array(s, sa)) ans -= i;
return ans;
}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> A(N);
for(int& a : A) cin >> a;
if(accumulate(A.begin(), A.end(), 0LL) >= 2e7) abort();
string S;
for(int i = 0; i < N; i++){
char c;
cin >> c;
S += string(A[i], c);
}
cout << solve(S).val() << endl;
}
tatyam