Submission #113939

#TimeUsernameProblemLanguageResultExecution timeMemory
113939Kastandacmp (balkan11_cmp)C++11
100 / 100
2185 ms82592 KiB
#include<bits/stdc++.h> #include "cmp.h" using namespace std; int d[4] = {6, 8, 10, 12}; void remember(int a) { for (int i = 0, j = 1; i < 4; j += d[i], i++) bit_set(j + a % d[i]), a /= d[i]; } int compare(int b) { int r[4] = {0, 0, 0, 0}; for (int i = 0, j = 1; i < 4; j += d[i], i++) r[i] = b % d[i], b /= d[i]; int nw = 6 + 8 + 10 + 12 + 1; for (int i = 3; ~ i; i--) { nw -= d[i]; if (!bit_get(nw + r[i])) { if (r[i] < d[i] / 2) { for (int j = 0; j < r[i]; j++) if (bit_get(nw + j)) return 1; return -1; } else { for (int j = r[i] + 1; j < d[i]; j++) if (bit_get(nw + j)) return -1; return 1; } } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...