Submission #568833

#TimeUsernameProblemLanguageResultExecution timeMemory
568833Jomnoicmp (balkan11_cmp)C++17
0 / 100
0 ms208 KiB
#include <bits/stdc++.h> #include "cmp.h" using namespace std; void remember(int n) { vector <int> digits; while(n > 0) { digits.push_back(n % 4); n /= 4; } while(digits.size() < 6) { digits.push_back(0); } reverse(digits.begin(), digits.end()); int base4 = 0; for(int i = 0; i < 6; i++) { base4 *= 4; base4 += digits[i]; bit_set(base4); } } int compare(int b) { vector <int> digits; while(b > 0) { digits.push_back(b % 4); b /= 4; } while(digits.size() < 6) { digits.push_back(0); } reverse(digits.begin(), digits.end()); int base4; int l = 0, r = 6; while(l < r) { int mid = (l + r) / 2; base4 = 0; for(int i = 0; i < mid; i++) { base4 *= 4; base4 += digits[i]; } if(bit_get(base4)) { l = mid; } else { r = mid - 1; } } if(l == 6) { return 0; } base4 = 0; for(int i = 0; i < l; i++) { base4 *= 4; base4 += digits[i]; } if(digits[l] >= 2) { base4 *= 4; base4 += 3; if(bit_get(base4)) { return -1; } return 1; } else { base4 *= 4; if(bit_get(base4)) { return 1; } return -1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...