Submission #57714

#TimeUsernameProblemLanguageResultExecution timeMemory
57714SpeedOfMagiccmp (balkan11_cmp)C++17
0 / 100
2613 ms125952 KiB
#include "cmp.h" #include <bits/stdc++.h> using namespace std; void remember(int a) { bit_set(a + 100); int oneAmount = 0; for (int i = 0; i < 12; i++) if (a & (1 << i)) oneAmount++; if (oneAmount > 6) { bit_set(13); a = -a; } for (int i = 0; i < 12; i++) if ((1 << i) & a) bit_set(i + 1); } int compare(int b) { srand(time(0)); int k = bit_get(100 + b); if (k) return 0; int d = bit_get(13); int pos[12]; for (int i = 0; i < 12; i++) pos[i] = -1; int l = 0, r = 11; while (1) { bool empt = all_of(pos + l, pos + r + 1, [](int z){return z != -1;}); if (empt) break; vector<int> forRand; for (int i = l + 1; i < r; i++) if (pos[i] == -1) forRand.push_back(i); int m = forRand[rand() % forRand.size()]; int p = bit_get(m + 1); pos[m] = p; if (((1 << m) & b) != pos[m]) l = m; } int a = 1 << l; if ((a < b && !d) || (a > b && d)) return 1; else return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...