Submission #23600

#TimeUsernameProblemLanguageResultExecution timeMemory
236000xrgbQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
100 / 100
1711 ms25720 KiB
static int M[924][6]; static int Mr = 0; static void M_init(); int encode (int n, int x, int y) { if (!Mr) M_init(); for (int i = 0; i < 6; ++i) { int j; for (j = 0; j < 6; ++j) { if (M[x][i] == M[y][j]) break; } if (j == 6) return M[x][i]; } return -1; } void M_init() { int arr[6] = {1, 2, 3, 4, 5, 6}; for (int i = 1; i <= 920; ++i) { for (int j = 5; j >= 0; --j) { if (arr[j] < 7 + j) { int p = arr[j]; for (int k = j; k < 6; ++k) arr[k] = ++p; break; } } for (int j = 0; j < 6; ++j) M[i][j] = arr[j]; } Mr = 1; }
static int M[924][6]; static int Mr = 0; static void M_init(); int decode (int n, int q, int h) { if (!Mr) M_init(); for (int i = 0; i < 6; ++i) { if (M[q][i] == h) return 1; } return 0; } void M_init() { int arr[6] = {1, 2, 3, 4, 5, 6}; for (int i = 1; i <= 920; ++i) { for (int j = 5; j >= 0; --j) { if (arr[j] < 7 + j) { int p = arr[j]; for (int k = j; k < 6; ++k) arr[k] = ++p; break; } } for (int j = 0; j < 6; ++j) M[i][j] = arr[j]; } Mr = 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...