Submission #70421

#TimeUsernameProblemLanguageResultExecution timeMemory
70421spencercomptonQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
0 / 100
1369 ms263168 KiB
#include <bits/stdc++.h> using namespace std; vector<string> ans; string cur = "000000000000"; void gen(int now, int rem){ if(rem<0){ return; } int extra = 12-now; if(extra<rem){ return; } if(now==12 && rem==0){ ans.push_back(cur); } if(now<12){ cur[now] = '0'; gen(now+1,rem); cur[now] = '1'; gen(now+1,rem-1); } } int encode (int n, int x, int y) { gen(0,6); x--; y--; for(int i = 0; i<12; i++){ if(ans[x][i]=='1' && ans[y][i]=='0'){ return i+1; } } assert(false); return 69; }
#include <bits/stdc++.h> using namespace std; vector<string> ans1; string cur1 = "000000000000"; void gen1(int now, int rem){ if(rem<0){ return; } int extra = 12-now; if(extra<rem){ return; } if(now==12 && rem==0){ ans1.push_back(cur1); } if(now<12){ cur1[now] = '0'; gen1(now+1,rem); cur1[now] = '1'; gen1(now+1,rem-1); } } int decode (int n, int q, int h) { gen1(0,6); if(ans1[q-1][h-1]=='1'){ return 1; } else{ return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...