이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#define debug(...) 42
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#include "brperm.h"
#else
void init(int n, const char s[]);
int query(int i, int k);
#endif
int n;
string s;
void init(int N, const char S[]) {
n = N;
s = string(S, S + N);
}
int swapped(int poz, int put) {
int a = 0;
for (int i = 0;i < put;i++) {
a = (a<<1) + (poz&1);
poz = (poz>>1);
}
return a;
}
int query(int i, int k) {
if (i + (1 << k) > n) {
return 0;
}
if (k < 2) {
return 1;
}
for (int j = 0; j < (1 << k); j++) {
if (s[i + j] != s[i + swapped(j, k)]) {
return 0;
}
}
return 1;
}
#ifdef LOCAL
char __s[(int)5e5 + 10] = {};
int main() {
cin >> __s;
init(strlen(__s), __s);
int __x, __y;
while (cin >> __x >> __y)
cout << query(__x, __y) << '\n';
return 0;
}
#endif
# | 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... |