# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
478745 | 2021-10-08T08:24:29 Z | Tenis0206 | Brperm (RMI20_brperm) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "brperm.h" using namespace std; char b[100005]; string s; int query(int poz, int k) { int l = (1<<k); if(poz+l-1>=s.size()) { return 0; } for(int i=poz;i<=poz+l-1;i++) { int sim=0; for(int b=0;b<k;b++) { if((i-poz)&(1<<b)) { sim+=(1<<(k-b-1)); } } if(s[i]!=s[sim+poz]) { return 0; } } return 1; } void init(int n, char a[]) { for(int i=0;i<n;i++) { s.push_back(a[i]); } } /*int main() { freopen("nr.in","r",stdin); freopen("nr.out","w",stdout); int n,q; char s[1000005]; cin>>n; cin>>s; init(n,s); cin>>q; for(int i=1;i<=q;i++) { int poz,k; cin>>poz>>k; cout<<query(poz,k)<<'\n'; } return 0; } */