# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
596657 | pedroslrey | Brperm (RMI20_brperm) | C++17 | 0 ms | 0 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 <bits/stdc++.h>
#include "brperm.h"
using namespace std;
const int MAXN = 1010;
char s[MAXN];
int n;
void init(int nn, const char ss[]) {
n = nn;
for (int i = 0; i < n; ++i)
s[i] = ss[i];
}
int query(int x, int k) {
for (int mask = 0; mask < 1 << k; ++mask) {
int rev = 0;
for (int i = 0; i < k; ++i)
if (mask & (1 << i)) rev |= 1 << (k - 1 - i);
if (s[x + mask] != s[x + rev]) return 0;
}
return 1;
}