# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1164380 | Darren0724 | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++20 | 698 ms | 39800 KiB |
#include <bits/stdc++.h>
using namespace std;
vector<int> code(1024, 0);
void build(){
int p=1;
for(int i=0;i<(1<<12);i++){
int cnt=0;
for(int j=0;j<12;j++){
if(i&(1<<j)){
cnt++;
}
}
if(cnt==6)code[p++]=i;
}
}
int encode (int n, int x, int y) {
if(code[1]==0){
build();
}
for(int i=0;i<12;i++){
int a=code[x]&(1<<i);
int b=code[y]&(1<<i);
if(a>b){
return i+1;
}
}
}
#include <bits/stdc++.h>
using namespace std;
vector<int> code1(1024, 0);
void build1(){
int p=1;
for(int i=0;i<(1<<12);i++){
int cnt=0;
for(int j=0;j<12;j++){
if(i&(1<<j)){
cnt++;
}
}
if(cnt==6)code1[p++]=i;
}
}
int decode (int n, int q, int h) {
if(code1[1]==0){
build1();
}
if(code1[q]&(1<<h-1)){
return 1;
}
else{
return 0;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |