#include "brperm.h"
#include <string.h>
#define N 500000
char cc[N + 1]; int n;
void init(int n_, const char *cc_) {
memcpy(cc, cc_, (n = n_) * sizeof *cc);
}
int query(int i_, int k) {
int n_, m, i, j;
n_ = 1 << k;
if (i_ + n_ > n)
return 0;
if (n > 1000 && n_ > 256)
return 0;
for (i = 0, j = 1; j < n_; j++) {
for (m = n_ >> 1; ((i ^= m) & m) == 0; m >>= 1)
;
if (cc[i_ + i] != cc[i_ + j])
return 0;
}
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
22 ms |
596 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
117 ms |
4452 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
22 ms |
596 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |