Submission #132882

#TimeUsernameProblemLanguageResultExecution timeMemory
132882Osama_AlkhodairyQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
100 / 100
1616 ms79768 KiB
#include <bits/stdc++.h> using namespace std; vector <vector <int> > all; int encode (int n, int x, int y) { x--; y--; const int K = 12; if(all.size() == 0){ for(int i = 0 ; i < (1 << K) ; i++){ if(__builtin_popcount(i) != K / 2) continue; vector <int> cur; for(int j = 0 ; j < K ; j++){ if((i >> j) & 1) cur.push_back(j); } all.push_back(cur); } } for(auto &i : all[x]){ if(count(all[y].begin(), all[y].end(), i)) continue; return i + 1; } assert(false); }
#include <bits/stdc++.h> using namespace std; vector <vector <int> > all; int decode (int n, int q, int h) { h--; q--; const int K = 12; if(all.size() == 0){ for(int i = 0 ; i < (1 << K) ; i++){ if(__builtin_popcount(i) != K / 2) continue; vector <int> cur; for(int j = 0 ; j < K ; j++){ if((i >> j) & 1) cur.push_back(j); } all.push_back(cur); } } for(auto &i : all[q]){ if(i == h) return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...