# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
642666 | TimDee | Brperm (RMI20_brperm) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstring>
#include <iostream>
char s[(int)5e5 + 10] = {};
//#include "brperm.h"
#include <bits/stdc++.h>
using namespace std;
string S;
void init(int n, const char s[]) {
S=s;
}
int query(int ind, int k) {
for (int i=ind; i<ind+(1<<k); ++i) {
int j=0;
for (int b=k-1; b>=0; --b) {
j+=(((i-ind)>>b)&1)<<(k-1-b);
}
if (S[i]!=S[ind+j]) return 0;
}
return 1;
}
int main() {
cin >> s;
init(strlen(s), s);
int x, y;
while (cin >> x >> y)
cout << query(x, y) << '\n';
return 0;
}