제출 #239632

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2396322020-06-16 22:10:34eohomegrownappsPalindromic Partitions (CEOI17_palindromic)C++14
100 / 100
503 ms35816 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll m = 1000000007;
ll p = 31;
ll pows[1000005];
void run(){
string s;
cin>>s;
ll n= s.size();
vector<ll> arr(n);
for (ll i = 0; i<n; i++){
arr[i]=s[i]-'a'+1;
}
vector<ll> ltor(n);//1,x+1,x^2+x+1...
//vector<ll> rtol(n);//...x^2+x+1,x+1,1
ltor[0]=arr[0];
for (ll i = 1; i<n; i++){
ltor[i]=(ltor[i-1]*p+arr[i])%m;
}
/*rtol[n-1]=arr[n-1];
for (ll i = n-2; i>=0; i--){
rtol[i]=(rtol[i+1]*p+arr[i])%m;
}*/
ll cnt = 0;
ll prevstart = 0;
for (ll i = 0; i<n; i++){
//check if prevstart to i forms a block
ll pref = ltor[i];
ll sub = prevstart==0?0:(ltor[prevstart-1]*pows[i-prevstart+1])%m;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...