# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1094525 |
2024-09-29T19:04:07 Z |
alexdd |
Brperm (RMI20_brperm) |
C++17 |
|
3000 ms |
154200 KB |
#include "brperm.h"
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+9;
long long p[530005];
int put(int a, int exp)
{
if(exp==0)
return 1;
if(exp%2==0)
return put(a*a%MOD,exp/2);
else
return put(a*a%MOD,exp/2)*a%MOD;
}
long long hsh[500005][19];
long long normal[500005][19];
void init(int n, const char s[])
{
p[0]=1;
p[1]=31;
for(int i=2;i<=(1<<19);i++)
p[i] = (p[i-1]*p[1])%MOD;
for(int i=0;i<n;i++)
{
hsh[i][0] = normal[i][0] = s[i];
}
for(int k=1;k<19;k++)
{
for(int i=0;i+(1<<k)-1<n;i++)
{
hsh[i][k] = (hsh[i][k-1] + hsh[i+(1<<(k-1))][k-1]*p[(1<<(18-k))])%MOD;
for(int j=0;j<(1<<k);j++)
{
normal[i][k] = (normal[i][k] + s[i+j]*p[j*(1<<(18-k))])%MOD;
}
}
}
}
int query(int i, int k)
{
return hsh[i][k] == normal[i][k];
}
/*
axxyxxyb
0 3
1 1
0 2
3 2
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
4696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
4696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3044 ms |
154200 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
4696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |