# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1276174 | Aviansh | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++20 | 7083 ms | 2916 KiB |
#include <bits/stdc++.h>
using namespace std;
int encode (int n, int x, int y) {
int pos[n+1];
fill(pos,pos+n+1,0);
int perm[12];
fill(perm,perm+12,0);
fill(perm,perm+6,1);
sort(perm,perm+12);
for(int i = 1;i<=n;i++){
for(int j = 0;j<12;j++){
if(perm[j]){
pos[i]+=(1<<j);
}
}
next_permutation(perm,perm+12);
}
int p = pos[x]^pos[y];
for(int i = 0;i<12;i++){
if(p&(1<<i)){
if(pos[x]&(1<<i))
return i+1;
}
}
assert(0);
}
#include <bits/stdc++.h>
using namespace std;
int decode (int n, int q, int h) {
h--;
int pos[n+1];
fill(pos,pos+n+1,0);
int perm[12];
fill(perm,perm+12,0);
fill(perm,perm+6,1);
sort(perm,perm+12);
for(int i = 1;i<=n;i++){
for(int j = 0;j<12;j++){
if(perm[j]){
pos[i]+=(1<<j);
}
}
next_permutation(perm,perm+12);
}
if(pos[q]&(1<<h)){
return 1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |