#include "brperm.h"
#include <cassert>
#include <string>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const int MAXN = 500008;
int N;
string s;
void init(int n, const char s_[]) {
N = n;
for (int i = 0; i < n; ++i)
s.push_back(s_[i]);
return;
//ll raymoo = 1;
//for (int i = 0; i < n; ++i) {
//phash[i] = (phash[i - 1] + raymoo * (s[i] - 'a')) % MOD;
//raymoo = (raymoo * MUL) % MOD;
//cout << phash[i] << ' ';
//}
//cout << endl;
//return;
}
int lg2(int n) {
int cnt = 0;
while (n > 1) {
n >>= 1;
++cnt;
}
return cnt;
}
int query(int l, int k) {
k = lg2(k);
//if (k < 0)
//exit(177013);
//if (k >= 10)
//exit(200834);
assert(l + (1 << k) <= N + 2400);
vector<int> ps = {0};
for (int t = 0; t < k; ++t) {
for (int i = 0; i < (1 << t); ++i)
ps.push_back(ps[i] + (1 << (k - t - 1)));
}
for (int i = 0; i < (1 << k); ++i) {
if (s[l + i] != s[l + ps[i]])
return 0;
}
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
169 ms |
2488 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |