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 "brperm.h"
#include <bits/stdc++.h>
using namespace std;
char S[(int)1e5+10];
int n;
void init(int N, const char s[]) {
n=N;
for (int i=0; i<n; ++i) S[i]=s[i];
}
int rev(int x, int k) {
int ret=0;
for (int b=k-1; b>=0; --b) {
ret+=((x>>b)&1)<<(k-1-b);
}
return ret;
}
int query(int ind, int k) {
if (ind + (1ll<<k) -1 >=n) return false;
for (int i=ind; i<ind+(1ll<<k); ++i) {
int j=rev(i-ind,k);
//if ((j+ind>=S.length()) || (i>>S.length())) return false;
//cout<<i<<' '<<j+ind<<'\n';
if (S[i]!=S[j+ind]) return false;
}
return true;
}
# | 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... |