Submission #43875

#TimeUsernameProblemLanguageResultExecution timeMemory
43875kdk8361cmp (balkan11_cmp)C++17
100 / 100
2055 ms82652 KiB
#include "cmp.h" int shif[4] = { 480,48,6,1 }; int base[4] = { 50,30,10,1 }; int bi[4] = { 8,9,7,5 }; void remember(int n) { for (int i = 0; i < 4; i++) { bit_set(base[i] + n / shif[i]); n %= shif[i]; } } int compare(int b) { int cur[4] = { 0, }; for (int i = 0; i < 4; i++) { cur[i] = b / shif[i]; b %= shif[i]; } for (int i = 0; i < 4; i++) { if (bit_get(base[i] + cur[i])) continue; if (cur[i] > bi[i] / 2) { int l = base[i] + cur[i] + 1, r = base[i] + bi[i]; for (; l <= r; l++) if (bit_get(l)) return -1; return 1; } int l = base[i], r = base[i] + cur[i] - 1; for (; l <= r; l++) if (bit_get(l)) return 1; return -1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...