Submission #842114

#TimeUsernameProblemLanguageResultExecution timeMemory
842114LucaLucaMcmp (balkan11_cmp)C++17
100 / 100
1065 ms107132 KiB
#include <bits/stdc++.h> #include "cmp.h" using namespace std; int precalc[] = {0 + 1, 4096 + 1, 4096 + 1024 + 1, 4096 + 1024 + 256 + 1, 4096 + 1024 + 256 + 64 + 1, 4096 + 1024 + 256 + 64 + 16 + 1, 4096 + 1024 + 256 + 64 + 16 + 4 + 1}; void remember (int a) { for (int bt = 0; bt < 6; bt++) { if (((a >> (bt * 2)) + precalc[bt]) < 1) { // cout << (a >> 0) << ' ' << precalc[bt] << '\n'; } bit_set((a >> (bt * 2)) + precalc[bt]); } } int compare (int b) { int l = 0, r = 6; while (l < r) { int mid = (l + r) / 2; if (bit_get((b >> (mid * 2)) + precalc[mid])) { r = mid; } else { l = mid + 1; } } if (!r) { return 0; } r--; int d = ((b >> (2 * r)) & 3); if (d == 0) { return -1; } else if (d == 3) { return +1; } else if (d == 2) { int val = (b >> (2 * r)); val -= val & 3; val += 3; if (bit_get( val + precalc[r])) { return -1; } else { return +1; } } else { int val = (b >> (2 * r)); val -= val & 3; if (bit_get(val + precalc[r])) { return +1; } else { return -1; } } return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...