# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
596585 |
2022-07-14T21:15:10 Z |
Deepesson |
Brperm (RMI20_brperm) |
C++17 |
|
171 ms |
53080 KB |
#include <bits/stdc++.h>
#define MAX 505000
void init(int n, const char s[]);
int query(int i, int k);
int prefsum[MAX][26];
int inverte(int x,int k){
int ans=0;
for(int i=0;i!=k;++i){
int u = (k-1)-i;
if((1<<i)&x)ans+=1<<u;
}
return ans;
}
int lim;
char vals[MAX];
void init(int n, const char s[]) {
for(int j=0;j!=n;++j){
vals[j]=s[j];
for(int k=0;k!=26;++k){
prefsum[j+1][k]=prefsum[j][k];
}
prefsum[j+1][s[j]-'a']++;
}
lim = n;
}
int count=0;
int query(int i, int k) {
int sz = 1<<(k);
if(i+sz>lim)return 0;
if(k>3){
int r=i+sz-2;
for(int j=0;j!=26;++j){
int p = prefsum[r][j]-prefsum[i+1][j];
if(p&1)return 0;
}
}
for(int j=0;j!=sz;++j){
int mirror = inverte(j,k);
if(vals[mirror+i]!=vals[j+i])return 0;
++count;
// if(count==25000)break;
}
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
171 ms |
53080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |