Submission #755113

#TimeUsernameProblemLanguageResultExecution timeMemory
755113StickfishBrperm (RMI20_brperm)C++17
50 / 100
3063 ms1908 KiB
#include "brperm.h" #include <iostream> #include <vector> using namespace std; int rvs_pos(int i, int k) { int ans = 0; for (int bt = 0; bt < k; ++bt) if (i & (1 << bt)) { ans += 1 << (k - bt - 1); } return ans; } string s; void init(int n, const char s0[]) { s = ""; for (int i = 0; i < n; ++i) s.push_back(s0[i]); } int query(int l, int k) { if (l + (1 << k) > s.size()) return 0; vector<char> a(1 << k); vector<char> b(1 << k); for (int i = 0; i < (1 << k); ++i) { //cout << rvs_pos(i, k) << "(" << s[l + i] << ' ' << s[l + rvs_pos(i, k)] << ") "; if (s[l + i] != s[l + rvs_pos(i, k)]) { return 0; } } //cout << endl; return 1; }

Compilation message (stderr)

brperm.cpp: In function 'int query(int, int)':
brperm.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     if (l + (1 << k) > s.size())
      |         ~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...