이 제출은 이전 버전의 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[]) {
    s = string(S, S + N);
}
int swapped(int i, int k) {
    int a = 1;
    int b = 1 << (k - 1);
    if (bool(i & a) == bool(i & b)) {
        return i;
    } else {
        i ^= a;
        i ^= b;
        return i;
    }
}
int query(int i, int k) {
    if (i + (1 << k) > n) {
        return false;
    }
    string t(s.begin() + i, s.begin() + i + (1 << k));
    for (int j = 0; j < (1 << k); j++) {
        if (t[j] != t[swapped(j, k)]) {
            return false;
        }
    }
    return true;
}
#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... |