제출 #163958

#제출 시각아이디문제언어결과실행 시간메모리
163958rolypolyvg295cmp (balkan11_cmp)C++14
100 / 100
1904 ms99004 KiB
#include "cmp.h" #include <iostream> using namespace std; void remember(int n) { int a = n >> 9; int b = (n >> 6) & ((1<<3)-1); int c = (n >> 3) & ((1<<3)-1); int d = n & ((1<<3)-1); bit_set(d + 1); bit_set(c + 1 + (1<<3)); bit_set((a<<3) + b + 1 + (1<<6)); bit_set(a + 1 + (1<<12)); } int check_triple(int n, int offset, int extra){ if (n >= 4){ for (int i = 7; i > n; i--) if (bit_get(i + offset + extra)) return -1; return 1; }else{ for (int i = 0; i < n; i++) if (bit_get(i + offset + extra)) return 1; return -1; } } int compare(int n) { int a = n >> 9; int b = (n >> 6) & ((1<<3)-1); int c = (n >> 3) & ((1<<3)-1); int d = n & ((1<<3)-1); if (bit_get((a<<3) + b + 1 + (1<<6))){ if (bit_get(c + 1 + (1<<3))){ if (bit_get(d + 1)){ return 0; }else{ return check_triple(d, 0, 1); } }else{ return check_triple(c, 0, 1 + (1<<3)); } }else{ if (bit_get(a + 1 + (1<<12))){ return check_triple(b, a<<3, 1 + (1<<6)); }else{ return check_triple(a, 0, 1 + (1<<12)); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...