Submission #398718

# Submission time Handle Problem Language Result Execution time Memory
398718 2021-05-04T18:41:57 Z MilosMilutinovic Brperm (RMI20_brperm) C++14
Compilation error
0 ms 0 KB
/**
 *    author:  milos
 *    created: 04.05.2021 20:27:22       
**/
#include <bits/stdc++.h>
#include "brperm.h"
 
using namespace std;
 
string s = "";
 
void init(int n, char seq[]) {
  for (int i = 0; i < n; i++) {
    s += seq[i];
  }  
}
 
int Rev(int x, int k) {
  int ret = 0;
  for (int i = 0; i < k; i++) {
    if (x & (1 << i)) {
      ret += (1 << (k - i - 1));  
    }
  }
  return ret;
}
 
int query(int i, int k) {
  if (i + (1 << k) > s.size()) {
    return 0;
  }
  for (int j = i; j < i + (1 << k); j++) {
    if (s[i] != s[i + Rev(j - i, k)]) {
      return 0;  
    }
  }
  return 1;
}

Compilation message

brperm.cpp: In function 'int query(int, int)':
brperm.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   if (i + (1 << k) > s.size()) {
      |       ~~~~~~~~~~~~~^~~~~~~~~~
/tmp/ccts7CI5.o: In function `main':
grader.cpp:(.text.startup+0xa0): undefined reference to `init(int, char const*)'
collect2: error: ld returned 1 exit status