# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
858028 |
2023-10-07T10:30:38 Z |
Denkata |
Brperm (RMI20_brperm) |
C++14 |
|
3000 ms |
9292 KB |
#include<bits/stdc++.h>
#include "brperm.h"
using namespace std;
const int maxn = 5e5+3;
char c[maxn];
int st[100],i,j,p,q,N,m,k,l,opposite[maxn],pos[maxn];
void precompute(int l)
{
st[0] = 1;
for(i=1;i<=l;i++)
st[i] = st[i-1]*2;
}
void init (int n,const char s[])
{
N = n;
for(i=0;i<n;i++)
c[i] = s[i];
l = 1;
while((1<<l)<=n)
l++;
precompute(l);
k = 1;
for(i=0;i<n;i++)
{
if((1<<k)<=i)
k++;
int opp = 0;
for(j=0;(1<<j)<=i;j++)
{
if(((1<<j)&i))
opp|=(1<<(k-j-1));
}
opposite[i] = opp;
pos[i] = k;
}
}
int query(int i,int k)
{
for(j=i;j<i+st[k];j++)
{
q = j-i;
p = opposite[q]*st[k-pos[q]];
if(c[p+i]!=c[j])
return 0;
}
return 1;
}
/**
int main()
{
init(8,"axxyxxyb");
cout<<query(0, 2);
return 0;
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3047 ms |
9292 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4440 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |