Submission #147353

#TimeUsernameProblemLanguageResultExecution timeMemory
147353IohcEjnimcmp (balkan11_cmp)C++14
100 / 100
2178 ms82680 KiB
#include "cmp.h" // 6 8 10 12 // 6 48 480 ?? int sz[5] = { 0, 12, 10, 8, 6 }; int num[5][20] = { {0, }, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, }, {13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, }, {23, 24, 25, 26 ,27, 28, 29, 30, 0, }, {31, 32, 33, 34, 35, 36, 0, } }; int dnum[5] = { 0, 480, 48, 6, 1 }; void remember(int n) { for (int i = 1; i <= 4; i++) { int val = n / dnum[i]; n %= dnum[i]; bit_set(num[i][val]); } } int compare(int b) { for (int i = 1; i <= 4; i++) { int val = b / dnum[i]; b %= dnum[i]; int res = bit_get(num[i][val]); if (res == 1) continue; int mode = false; if (val >= sz[i] / 2) mode = true; int s = mode ? sz[i] / 2 : 0; int e = mode ? sz[i] : sz[i] / 2; for (int j = s; j < e; j++) { if (j == val) continue; res = bit_get(num[i][j]); if (res == 0) continue; return j < val ? 1 : -1; } return mode ? 1 : -1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...