#include<vector>
using namespace std;
vector<int> sts;
int init=-1;
int encode (int n, int x, int y) {
if(init==-1) {
init=1;
for(int i=0;i<(1<<12);++i) {
int cnt=0;
for(int j=0;j<12;++j) {
cnt+=((1<<j)&i)!=0;
}
if(cnt==6) sts.push_back(i);
}
}
int X=sts[x], Y=sts[y];
int h=-1;
for(int j=0;j<12;++j) {
if((X&(1<<j)) && !(Y&(1<<j))) h=j+1;
}
return h;
}
#include<vector>
using namespace std;
vector<int> sts;
int init=-1;
int decode (int n, int q, int h) {
if(init==-1) {
init=1;
for(int i=0;i<(1<<12);++i) {
int cnt=0;
for(int j=0;j<12;++j) {
cnt+=((1<<j)&i)!=0;
}
if(cnt==6) sts.push_back(i);
}
}
return (sts[q]&(1<<(h-1)))>0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1686 ms |
127312 KB |
Output is correct - maxh = 12 |
2 |
Correct |
1685 ms |
127056 KB |
Output is correct - maxh = 12 |