Submission #494812

#TimeUsernameProblemLanguageResultExecution timeMemory
494812ovidiush11Brperm (RMI20_brperm)C++14
0 / 100
4 ms3080 KiB
#include <bits/stdc++.h> #include "brperm.h" using namespace std; std::string st; void init(int n, const char s[]) { st = s; return; } int query(int i, int k) { for(int j = 0;j < pow(2,k);j++) { string a; int n = j,p = k; while(n != 0) { if(n % 2 == 1)a+='1'; else a+='0'; n/=2; } while(a.size() != k)a+='0'; n = 0; int x = 0,y = a.size(); while(x < y) { if(a[x] == '1')n += pow(2,y-x-1); x++; } if(st[i+j] != st[i+n])return 0; } return 1; }

Compilation message (stderr)

brperm.cpp: In function 'int query(int, int)':
brperm.cpp:25:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |         while(a.size() != k)a+='0';
      |               ~~~~~~~~~^~~~
brperm.cpp:18:19: warning: unused variable 'p' [-Wunused-variable]
   18 |         int n = j,p = k;
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...