Submission #354410

#TimeUsernameProblemLanguageResultExecution timeMemory
354410rqiQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
100 / 100
5645 ms25008 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef vector<int> vi; typedef vector<pi> vpi; #define pb push_back #define f first #define s second #define mp make_pair #define ins insert #define sz(x) (int)(x).size() #define all(x) begin(x), end(x) const int maxh = 12; vector<vector<bool>> subs; void genSub(){ vector<bool> sub; for(int i = 0; i < maxh/2; i++){ sub.pb(0); } for(int i = maxh/2; i < maxh; i++){ sub.pb(1); } do{ subs.pb(sub); } while(next_permutation(all(sub))); } bool calculated = false; void precalc(){ if(calculated) return; calculated = true; genSub(); } int encode (int n, int x, int y) { precalc(); x--; y--; for(int i = 0; i < maxh; i++){ if(subs[x][i] && !subs[y][i]){ return i+1; } } return -1; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef vector<int> vi; typedef vector<pi> vpi; #define pb push_back #define f first #define s second #define mp make_pair #define ins insert #define sz(x) (int)(x).size() #define all(x) begin(x), end(x) const int maxh = 12; vector<vector<bool>> subs; void genSub(){ vector<bool> sub; for(int i = 0; i < maxh/2; i++){ sub.pb(0); } for(int i = maxh/2; i < maxh; i++){ sub.pb(1); } do{ subs.pb(sub); } while(next_permutation(all(sub))); } bool calculated = false; void precalc(){ if(calculated) return; calculated = true; genSub(); } int decode (int n, int q, int h) { precalc(); q--; if(subs[q][h-1]) return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...