Submission #724208

#TimeUsernameProblemLanguageResultExecution timeMemory
724208MojoLakecmp (balkan11_cmp)C++17
100 / 100
1387 ms96036 KiB
#include "cmp.h" #include <bits/stdc++.h> using namespace std; int d[6] = {1, 4097, 5121, 5377, 5441, 5457}; void remember(int x){ for(int i = 0; i < 6; ++i){ bit_set((x>>(2*i)) + d[i]); } } int compare(int x){ int lo = 0, hi = 6; while(lo < hi){ int m = (hi + lo) / 2; int p = (x>>(2 * m)) + d[m]; if(bit_get(p))hi = m; else lo = m + 1; } if(lo == 0){ return 0; } int p = x>>(2 * (lo-1)); int ld = p & 3; if(ld == 0)return -1; if(ld == 3)return 1; if(ld == 1){ if(bit_get(4 * (x>>(2 * lo)) + d[lo-1]))return 1; else return -1; } if(ld == 2){ if(bit_get(4 * (x>>(2 * lo)) + 3 + d[lo-1]))return -1; else return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...