Submission #43943

#TimeUsernameProblemLanguageResultExecution timeMemory
43943ik_ecmp (balkan11_cmp)C++17
100 / 100
2094 ms96772 KiB
#include "cmp.h" int sec[4] = { 409, 51,8,2 }; int ch[4][2] = { 4,4, 7,6, 3,2, 4,3 }; int p[4], ofs[4] = { 4096, 4106, 4186, 4666 }; bool big; int index(int lev, int rm) { int div = 10 - 2 * lev; for (int i = 0; i < div; ++i) { if (i < ch[lev][big]) { if (rm >= sec[lev]) rm -= sec[lev]; else { big = 0; p[lev] = i; break; } } else { if (rm >= sec[lev] + 1) rm -= (sec[lev] + 1); else { big = 1; p[lev] = i; break; } } } return rm; } void remember(int n) { int a = 0; bit_set(n+1); for (int i = 0; i < 4; ++i) { n = index(i, n); bit_set(ofs[i] + a + p[i]+1); a = (a + p[i]) * (8 - 2 * i); } } int compare(int b) { int tmp = b, a = 0; for (int i = 0; i < 3; i++) { b = index(i, b); if (bit_get(ofs[i] + a + p[i] + 1) == 0) { if (p[i] < (5 - i)) { for (int k = 0; k < p[i]; ++k) if (bit_get(ofs[i] + a + k + 1)) return 1; return -1; } else { for (int k = p[i]+1; k < (10 - 2 * i); ++k) if (bit_get(ofs[i] + a + k + 1)) return -1; return 1; } } a = (a + p[i]) * (8 - 2 * i); } if (big && b == 7) { if (bit_get(tmp + 1)) return 0; else if (bit_get(tmp + 2)) return -1; else return 1; /*if (bit_get(ofs[3] + a + p[3] + 1)) { if (bit_get(tmp + 1)) return 0; else if (b == 0) return -1; else return 1; } else return 1;*/ } else { b = index(3, b); if (bit_get(ofs[3] + a + p[3] + 1)) { if (bit_get(tmp + 1)) return 0; else if (b == 0) return -1; else return 1; } else { if (p[3] < 2) { if (bit_get(ofs[3] + a + 1)) return 1; return -1; } else { if (bit_get(ofs[3] + a + 3 + 1)) return -1; return 1; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...