Submission #452130

#TimeUsernameProblemLanguageResultExecution timeMemory
452130kingfran1907Question (Grader is different from the original contest) (CEOI14_question_grader)C++14
100 / 100
3453 ms24116 KiB
#include <bits/stdc++.h> using namespace std; int fac[20]; inline int chos(int n, int k) {return fac[n] / (fac[k] * fac[n - k]);} vector< int > get(int x) { vector< int > out; int cnt = 6; for (int i = 1; i < 13 && cnt; i++) { int tr = chos(12 - i, cnt - 1); if (x >= tr) x-= tr; else { out.push_back(i); cnt--; } } return out; } int encode (int n, int x, int y) { fac[0] = 1; for (int i = 1; i < 13; i++) fac[i] = i * fac[i - 1]; vector< int > vx = get(x), vy = get(y); for (int tren : vx) { bool flag = true; for (int ng : vy) if (tren == ng) flag = false; if (flag) return tren; } }
#include <bits/stdc++.h> using namespace std; int fac[20]; inline int chos(int n, int k) {return fac[n] / (fac[k] * fac[n - k]);} vector< int > get(int x) { vector< int > out; int cnt = 6; for (int i = 1; i < 13 && cnt; i++) { int tr = chos(12 - i, cnt - 1); if (x >= tr) x-= tr; else { out.push_back(i); cnt--; } } return out; } int decode (int n, int q, int h) { fac[0] = 1; for (int i = 1; i < 13; i++) fac[i] = i * fac[i - 1]; vector< int > v = get(q); bool flag = false; for (int tren : v) if (h == tren) flag = true; return flag; }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:26:26: warning: control reaches end of non-void function [-Wreturn-type]
   26 |  vector< int > vx = get(x), vy = get(y);
      |                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...