Submission #838117

# Submission time Handle Problem Language Result Execution time Memory
838117 2023-08-26T09:01:09 Z hgmhc cmp (balkan11_cmp) C++17
Compilation error
0 ms 0 KB
#include "cmp.h"

// a, b in [0,1<<12)



void remember(int a) { // a를 [1,10240]에 기록
  for (int k = 0; k < 6; ++k) {
    if ((a/64)>>k&1) bit_set(k+1);
  }
  int base = (a/64 + 1)*7;
  bit_set(base);
  for (int k = 1; k < 7; ++k) {
    if ((a%64)>>(k-1)&1) bit_set(base+k);
  }
}

int compare(int b) { // a와 b 비교
  int base = (b/64 + 1)*7;
  if (bit_get(base)) {
    int a = (b/64) << 6;
    for (int k = 1; k < 7; ++k) {
      if (bit_get(base+k)) {
        a |= 1<<(k-1);
      }
    }
    if (b < a) return -1;
    if (b == a) return 0;
    if (b > a) return 1;
  } else {
    int a = 0;
    for (int k = 0; k < 6; ++k) {
      if (bit_get(k+1)) a |= (1<<k) * 64;
    }
    if (b < a) return -1;
    if (b == a) return 0;
    if (b > a) return 1;
  }
  exit(0);
}

Compilation message

cmp.cpp: In function 'int compare(int)':
cmp.cpp:39:3: error: 'exit' was not declared in this scope
   39 |   exit(0);
      |   ^~~~
cmp.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^