# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
924190 | Camillus | Floppy (RMI20_floppy) | 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"
#define debug(...) 42
using namespace std;
#ifndef LOCAL
#include "floppy.h"
#else
void init(int n, const char s[]);
int query(int i, int k);
#endif
string s;
void init(int N, const char S[]) {
s = string(S, S + N);
}
int query(int i, int k) {
for (int j = 0; j < (1 << k); j++) {
auto t = bitset<32>(j).to_string();
reverse(t.begin(), t.end());
swap(t[0], t[k - 1]);
reverse(t.begin(), t.end());
int k = bitset<32>(t).to_ulong();
debug(j, k);
debug(s);
debug(i + j);
debug(i + k);
debug(s[i + j], s[i + k]);
if (s[i + j] != s[i + 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