# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
850656 | 2023-09-17T08:32:34 Z | alexdd | Brperm (RMI20_brperm) | C++17 | 0 ms | 0 KB |
#include "brperm.h" #include<bits/stdc++.h> using namespace std; int n; char s[500005]; int inv(int x, int p) { int aux=0; for(int i=0;i<p;i++) { if(((1<<i)&x)) { aux += (1<<(p-i-1)); } } return aux; } void init(int N, const char cit[]) { n=N; for(int i=0;i<n;i++) s[i]=cit[i]; return; } int query(int i, int k) { int lun=(1<<k); for(int pas=0;pas<500;pas++) { int x = rand()%lun; if(s[i+x]!=s[i+inv(x,k)]) return 0; } return 1; }