Submission #642741

#TimeUsernameProblemLanguageResultExecution timeMemory
642741TimDeeBrperm (RMI20_brperm)C++17
50 / 100
3087 ms1648 KiB
#include "brperm.h" #include <bits/stdc++.h> using namespace std; char S[(int)1e5+10]; int n; void init(int N, const char s[]) { n=N; for (int i=0; i<n; ++i) S[i]=s[i]; } int rev(int x, int k) { int ret=0; for (int b=k-1; b>=0; --b) { ret+=((x>>b)&1)<<(k-1-b); } return ret; } int query(int ind, int k) { if (ind + (1ll<<k) -1 >=n) return false; for (int i=ind; i<ind+(1ll<<k); ++i) { int j=rev(i-ind,k); //if ((j+ind>=S.length()) || (i>>S.length())) return false; //cout<<i<<' '<<j+ind<<'\n'; if (S[i]!=S[j+ind]) return false; } return true; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...