Submission #41556

#TimeUsernameProblemLanguageResultExecution timeMemory
41556pica4500cmp (balkan11_cmp)C++98
82 / 100
1825 ms83960 KiB
#include "cmp.h" //82점 비벼욧---!!! //2bit compression int getIdx(int n, int kth) { kth *= 2; //2kth Idx n >>= (kth - 2); n %= 4; return (10000 + (kth * 2) - 3 + n); } void remember(int n) { for (int i = 6; i > 0; i--) bit_set(getIdx(n, i)); int up = (n >> 6) + 1; bit_set(100 + up); } int compare(int b) { int up = (b >> 6) + 1; if (bit_get(100 + up)) { for (int i = 3; i > 0; i--) { int idx = getIdx(b, i); if (bit_get(idx)) continue; int c = (((idx - 10000) - 1) % 4) + 1; switch(c) { case 1: return -1; case 2: if (bit_get(idx - 1)) return 1; return -1; case 3: if (bit_get(idx + 1)) return -1; return 1; case 4: return 1; } } return 0; } else { for (int i = 6; i > 3; i--) { int idx = getIdx(b, i); if (bit_get(idx)) continue; int c = (((idx - 10000) - 1) % 4) + 1; switch (c) { case 1: return -1; case 2: if (bit_get(idx - 1)) return 1; return -1; case 3: if (bit_get(idx + 1)) return -1; return 1; case 4: return 1; } } return 0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...