Submission #26838

#TimeUsernameProblemLanguageResultExecution timeMemory
26838baactreeQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
100 / 100
2192 ms27608 KiB
#include <algorithm> #include <vector> using namespace std; vector<int> perm[921]; bool flag=false; int encode (int n, int x, int y) { if(!flag){ flag=true; for(int i=0;i<12;i++) perm[1].push_back(i>5); for(int i=2;i<921;i++){ perm[i]=perm[i-1]; next_permutation(perm[i].begin(),perm[i].end()); } } for(int i=0;i<12;i++) if(perm[x][i]==1&&perm[y][i]==0) return i+1; return 0; }
#include <algorithm> #include <vector> using namespace std; vector<int> perm[921]; bool flag=false; int decode (int n, int q, int h) { if(!flag){ flag=true; for(int i=0;i<12;i++) perm[1].push_back(i>5); for(int i=2;i<921;i++){ perm[i]=perm[i-1]; next_permutation(perm[i].begin(),perm[i].end()); } } return perm[q][h-1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...