Submission #642727

#TimeUsernameProblemLanguageResultExecution timeMemory
642727TimDeeBrperm (RMI20_brperm)C++17
0 / 100
124 ms6512 KiB
#include "brperm.h" #include <bits/stdc++.h> using namespace std; string S; void init(int n, const char s[]) { for (int i=0; i<n; ++i) S.push_back(s[i]); } int query(int ind, int k) { //++k; for (int i=ind; i<ind+(1ll<<k); ++i) { int j=0; for (int b=0; b<k; ++b) { j+=(((i-ind)>>b)&1)<<(k-1-b); } //cout<<i<<' '<<j<<'\n'; if ((j+ind>=S.length()) || (i>>S.length())) return 0; if (S[i]!=S[j+ind]) return false; } return true; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rand(int a, int b) { return a+(rng()%(b-a+1)); }

Compilation message (stderr)

brperm.cpp: In function 'int query(int, int)':
brperm.cpp:19:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         if ((j+ind>=S.length()) || (i>>S.length())) return 0;
      |              ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...