Submission #1294189

#TimeUsernameProblemLanguageResultExecution timeMemory
1294189m_bezrutchkaQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++20
0 / 100
7092 ms10300 KiB
#include <bits/stdc++.h> using namespace std; int biject[5000]; void build_bijection(int n) { int q = 1; for (int bm = 0; bm < (1 << 12); bm++) { if ((int) __builtin_popcount(bm) != 6) continue; biject[q] = bm; q++; if (q > n) break; } } int encode(int n, int x, int y) { build_bijection(n); x = biject[x]; y = biject[y]; for (int i = 0; i < 12; i++) { if ((x & (1 << i)) && !(y & (1 << i))) { return i + 1; } } return -1; }
#include <bits/stdc++.h> using namespace std; int biject[5000]; void build_bijection(int n) { int q = 1; for (int bm = 0; bm < (1 << 12); bm++) { if ((int) __builtin_popcount(bm) != 6) continue; biject[q] = bm; q++; if (q > n) break; } } int decode(int n, int q, int h) { build_bijection(n); q = biject[q]; h--; if (q & (1 << h)) return 1; else return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...