Submission #26784

# Submission time Handle Problem Language Result Execution time Memory
26784 2017-07-05T16:00:14 Z baactree cmp (balkan11_cmp) C++14
Compilation error
0 ms 0 KB
#include "cmp.h"

void remember(int n) {
    bit_set(10240-n);
    n++;
    while(n<5000){
        bit_set(n);
        n+=n&(-n);
    }
}

int compare(int b) {
    if(bit_set(10240-b))
        return 0;
    int ret=0;
    b++;
    while(b){
        ret+=bit_set(b);
        b-=b&(-b);
    }    
    if(ret>0)
        return 1;
    return -1;
}

Compilation message

cmp.cpp: In function 'int compare(int)':
cmp.cpp:13:15: error: could not convert 'bit_set((10240 - b))' from 'void' to 'bool'
     if(bit_set(10240-b))
        ~~~~~~~^~~~~~~~~
cmp.cpp:18:12: error: invalid operands of types 'int' and 'void' to binary 'operator+'
         ret+=bit_set(b);
         ~~~^~~~~~~~~~~~
cmp.cpp:18:23: error:   in evaluation of 'operator+=(int, void)'
         ret+=bit_set(b);
                       ^