#include <bits/stdc++.h>
#define MAX 505000
void init(int n, const char s[]);
int query(int i, int k);
int inverte(int x,int k){
int ans=0;
for(int i=0;i!=k;++i){
int u = (k-1)-i;
if((1<<i)&x)ans+=1<<u;
}
return ans;
}
int pec[MAX][20];
int lim;
char vals[MAX];
void init(int n, const char s[]) {
for(int j=0;j!=n;++j){
vals[j]=s[j];
}
for(int i=0;i!=20;++i){
int sz = 1<<i;
if(sz>MAX)break;
for(int k=0;k!=sz;++k){
pec[k][i]=inverte(k,i);
}
}
lim = n;
}
int query(int i, int k) {
int sz = 1<<(k);
if(i+sz>lim)return 0;
int count=0;
for(int j=0;j!=sz;++j){
int mirror = pec[j][k];
count++;
if(vals[mirror+i]!=vals[j+i])return 0;
if(count==2050)break;
}
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
20824 KB |
Output is correct |
2 |
Correct |
37 ms |
20736 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
20824 KB |
Output is correct |
2 |
Correct |
37 ms |
20736 KB |
Output is correct |
3 |
Correct |
69 ms |
21196 KB |
Output is correct |
4 |
Correct |
58 ms |
21136 KB |
Output is correct |
5 |
Correct |
56 ms |
21152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1473 ms |
22864 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
20824 KB |
Output is correct |
2 |
Correct |
37 ms |
20736 KB |
Output is correct |
3 |
Correct |
69 ms |
21196 KB |
Output is correct |
4 |
Correct |
58 ms |
21136 KB |
Output is correct |
5 |
Correct |
56 ms |
21152 KB |
Output is correct |
6 |
Incorrect |
1473 ms |
22864 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |