Submission #24558

#TimeUsernameProblemLanguageResultExecution timeMemory
24558BruteforcemanQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++11
100 / 100
2669 ms27532 KiB
#include "bits/stdc++.h" using namespace std; vector <int> v[1000]; void create() { if(!v[1].empty()) return ; int idx = 0; for(int i = 0; i < (1 << 12); i++) { if(__builtin_popcount(i) == 6) { ++idx; for(int j = 0; j < 12; j++) { if((i >> j) & 1) { v[idx].push_back(j + 1); } } } } } int encode (int n, int x, int y) { create(); set <int> s (v[y].begin(), v[y].end()); for(auto i : v[x]) { if(s.find(i) == s.end()) return i; } return -1; }
#include "bits/stdc++.h" using namespace std; vector <int> g[1000]; void generate() { if(!g[1].empty()) return ; int idx = 0; for(int i = 0; i < (1 << 12); i++) { if(__builtin_popcount(i) == 6) { ++idx; for(int j = 0; j < 12; j++) { if((i >> j) & 1) { g[idx].push_back(j + 1); } } } } } int decode (int n, int q, int h) { generate(); for(auto i : g[q]) { if(i == h) return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...