# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41557 | 2018-02-18T23:27:11 Z | pica4500 | cmp (balkan11_cmp) | C++ | 1832 ms | 83948 KB |
#include "cmp.h" //91점 비벼욧---!!! //3bit compression int getIdx(int n, int kth) { n >>= (kth * 3 - 3); n %= 8; return (10000 + (kth * 8) - 7 + n); } void remember(int n) { for (int i = 4; 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 = 2; i > 0; i--) { int idx = getIdx(b, i); if (bit_get(idx)) continue; int c = (((idx - 10000) - 1) % 8) + 1; if (c < 5) { for (int i = c - 1; i > 0; i--) if (bit_get(idx - (c - i))) return 1; return -1; } else { for (int i = c + 1; i < 9; i++) if (bit_get(idx + (i - c))) return -1; return 1; } } return 0; } else { for (int i = 4; i > 2; i--) { int idx = getIdx(b, i); if (bit_get(idx)) continue; int c = (((idx - 10000) - 1) % 8) + 1; if (c < 5) { for (int i = c - 1; i > 0; i--) if (bit_get(idx - (c - i))) return 1; return -1; } else { for (int i = c + 1; i < 9; i++) if (bit_get(idx + (i - c))) return -1; return 1; } } return 0; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1832 ms | 83948 KB | Output is partially correct - maxAccess = 11, score = 91 |