# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
397431 | Nicholas_Patrick | Palindromic Partitions (CEOI17_palindromic) | C++17 | 440 ms | 37344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <queue>
#include <array>
#include <string>
using namespace std;
const int hus=3;
const int mod[]={0x3fffffdd, 0x3fffffd7, 0x3fffffad};
const int base=123;
using hash_t=array<int, hus>;
hash_t powers[1000001];
void getPowers(){
for(int i=hus; i--;)
powers[0][i]=1;
for(int i=0; i<1000000; i++){
for(int j=hus; j--;)
powers[i+1][j]=(long long)powers[i][j]*base%mod[j];
}
}
vector<hash_t> getHash(string& s){
int n=s.size();
vector<hash_t> ret(n+1);
for(int i=hus; i--;)
ret[0][i]=0;
for(int i=0; i<n; i++){
for(int j=hus; j--;)
ret[i+1][j]=(ret[i][j]+(long long)powers[i][j]*s[i])%mod[j];
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |