Submission #596586

#TimeUsernameProblemLanguageResultExecution timeMemory
596586DeepessonBrperm (RMI20_brperm)C++17
0 / 100
232 ms4240 KiB
#include <bits/stdc++.h> #define MAX 505000 void init(int n, const char s[]); int query(int i, int k); 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 pec[MAX][20]; 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 i=0;i!=20;++i){ int sz = 1<<i; for(int k=0;k!=sz;++k){ pec[i][k]=inverte(k,i); } } lim = n; } int query(int i, int k) { int sz = 1<<(k); if(i+sz>lim)return 0; for(int j=0;j!=sz;++j){ int mirror = pec[k][j]; if(vals[mirror+i]!=vals[j+i])return 0; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...