Submission #857252

#TimeUsernameProblemLanguageResultExecution timeMemory
857252divadBrperm (RMI20_brperm)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "brperm.h" using namespace std; string str; void init(int n, const char s[]) { str = s; } int rev_bits(int x, int k){ int ans = 0; for(int i = 0; i < k; i++){ int bt = (x>>i)&1; ans += bt*(1<<(k-i-1)); } return ans; } int query(int i, int k){ int len = (1<<k); string sub = str.substr(pos, len); for(int i = 0; i < len; i++){ if(sub[i] != sub[rev_bits(i, k)]){ return false; } } return true; }

Compilation message (stderr)

brperm.cpp: In function 'int query(int, int)':
brperm.cpp:21:29: error: 'pos' was not declared in this scope; did you mean 'pow'?
   21 |     string sub = str.substr(pos, len);
      |                             ^~~
      |                             pow