Submission #1095669

#TimeUsernameProblemLanguageResultExecution timeMemory
1095669idiotcomputercmp (balkan11_cmp)C++11
0 / 100
475 ms96332 KiB
#include "cmp.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(x) (int) (x).size() int ch[6] = {1, 5, 22, 87, 344, 1369}; int pw[6] = {1,4,16,64,256,1024}; void remember(int value){ int s = 0; for (int i = 0; i < 6; i++){ s += pw[i] * (value%4); bit_set(s+ch[i]); value = value/4; } } int compare(int value){ vector<int> res(6); vector<int> cbit(6); int s = 0; int x; for (int i = 0; i < 6; i++){ s += pw[i] * (value%4); res[i] = s; cbit[i] = value%4; value = value/4; } int n = sz(res); int l = -1; int r = n; while (r-l>1){ x = (l+r)/2; if (bit_get(res[x]+ch[x])) l = x; else r = x; } l++; if (l == n) return 0; if (cbit[l] == 0) return -1; if (cbit[l] == 3) return 1; if (cbit[l] == 1){ x = 0; if (l > 0) x = res[l-1]; if (bit_get(x+ch[l])) return 1; return -1; } x = 0; if (l > 0) x = res[l-1]; x += pw[l]*3; if (bit_get(x+ch[l])) return -1; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...