Submission #354405

#TimeUsernameProblemLanguageResultExecution timeMemory
354405rqiQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
0 / 100
1 ms736 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; vi genSub(int ind){ vi sub; for(int i = 1; i <= maxh/2; i++){ sub.pb(i); } for(int i = 0; i < ind; i++){ next_permutation(all(sub)); } return sub; } int encode (int n, int x, int y) { x--; y--; vi subx = genSub(x); vi suby = genSub(y); vector<bool> insub1(maxh+1, 0); vector<bool> insub2(maxh+1, 1); for(int k = 0; k < sz(subx); k++){ insub1[subx[k]] = 1; } for(int k = 0; k < sz(suby); k++){ insub2[suby[k]] = 0; } for(int h = 1; h <= maxh; h++){ if(insub1[h] && insub2[h]){ return h; } } 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; vi genSub(int ind){ vi sub; for(int i = 1; i <= maxh/2; i++){ sub.pb(i); } for(int i = 0; i < ind; i++){ next_permutation(all(sub)); } return sub; } int decode (int n, int q, int h) { q--; vi subq = genSub(q); for(int i = 0; i < sz(subq); i++){ if(subq[i] == h) return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...