# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1070159 |
2024-08-22T12:00:42 Z |
AdamGS |
Brperm (RMI20_brperm) |
C++17 |
|
27 ms |
66332 KB |
#include "brperm.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const ll MOD=694202137, PI=2137;
const int LIM=1e5+7, LG=20;
ll hsh[LIM][LG], hshp[LIM][LG], tmp[LIM][LG], tmp2[LIM][LG], pot[2*LG];
void init(int n, const char s[]) {
pot[0]=PI;
rep(i, 2*LG-1) pot[i+1]=(pot[i]*pot[i])%MOD;
rep(i, n) hsh[i][0]=hshp[i][0]=s[i];
for(int i=1; i<LG; ++i) {
rep(j, n) if(j+(1<<i)<=n) {
hsh[j][i]=(hsh[j][i-1]+hsh[j+(1<<(i-1))][i-1]*pot[i-1])%MOD;
}
}
rep(i, n) rep(j, LG) tmp[i][j]=s[i];
for(int i=1; i<LG; ++i) {
for(int j=0; j<LG-1; ++j) {
rep(l, n) if(l+(1<<i)<=n) {
tmp2[l][j]=(tmp[l][j+1]+tmp[l+(1<<(i-1))][j+1]*pot[j])%MOD;
}
}
rep(l, n) hshp[l][i]=tmp2[l][0];
rep(j, LG) rep(l, n) {
tmp[j][l]=tmp2[j][l];
tmp2[j][l]=0;
}
}
}
int query(int i, int k) {
return hsh[i][k]==hshp[i][k];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
6748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
6748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
66332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
6748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |