제출 #26925

#제출 시각아이디문제언어결과실행 시간메모리
26925sgc109비교 (balkan11_cmp)C++11
19 / 100
2247 ms82628 KiB
#include "cmp.h"

void remember(int n) {
    int cnt = 0;
    int rev = 0;
    for(int i = 0 ; i < 12; i++) {
        if(n&(1<<i)) cnt++;
    }
    if(cnt > 6) rev = 1, bit_set(100);
    for(int i = 0 ; i < 12; i++){
        int cond = (n&(1<<i)) != 0;
        if(rev) cond = !cond;
        if(cond) bit_set(i+1);
    }
}

int compare(int b) {
    int rev = bit_get(100);
    for(int i = 0 ; i < 12; i++){
        int cond1 = (b & (1<<(11-i)));
        int cond2 = bit_get(12-i);
        if(rev) cond2 = !cond2;
        if(cond1 && !cond2) return 1;
        if(!cond1 && cond2) return -1;
    }
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...