# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
924242 |
2024-02-08T16:50:27 Z |
Camillus |
Brperm (RMI20_brperm) |
C++17 |
|
3000 ms |
1448 KB |
#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[]) {
n = N;
s = string(S, S + N);
}
int swapped(int i, int k) {
int j = 0;
for (int p = 0; p < k; p++) {
if (i & (1 << p)) {
j |= (1 << (k - p - 1));
}
}
return j;
}
int query(int i, int k) {
if (i + (1 << k) > n) {
return 0;
}
if (k < 2) {
return 1;
}
for (int j = 0; j < (1 << k); j++) {
if (s[i + j] != s[i + swapped(j, k)]) {
return 0;
}
}
return 1;
}
#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 |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
26 ms |
860 KB |
Output is correct |
4 |
Correct |
21 ms |
600 KB |
Output is correct |
5 |
Correct |
20 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3064 ms |
1448 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
26 ms |
860 KB |
Output is correct |
4 |
Correct |
21 ms |
600 KB |
Output is correct |
5 |
Correct |
20 ms |
604 KB |
Output is correct |
6 |
Execution timed out |
3064 ms |
1448 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |