Submission #1295355

#TimeUsernameProblemLanguageResultExecution timeMemory
1295355enzyQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++20
100 / 100
686 ms39736 KiB
#include<bits/stdc++.h>
using namespace std;
const int maxn=925;
int rep[maxn];
void pre(){
    int id=1;
    for(int mask=0;mask<(1<<12);mask++){
        int cnt=0;
        for(int k=0;k<12;k++) if(mask&(1<<k)) cnt++;
        if(cnt!=6) continue;
        rep[id]=mask;
        id++;
    }
}
bool first=true;
int encode(int n, int x, int y){
    if(first) pre();
    first=false;
    for(int k=0;k<12;k++){
        int atx=rep[x]&(1<<k), aty=rep[y]&(1<<k);
        if(atx^aty&&atx) return k+1;
    }
    return -1;
}
#include<bits/stdc++.h>
using namespace std;
const int maxn=925;
int pai[maxn];
void pos(){
	int id=1;
	for(int mask=0;mask<(1<<12);mask++){
	    int cnt=0;
	    for(int k=0;k<12;k++) if(mask&(1<<k)) cnt++;
		if(cnt!=6) continue;
	   	pai[id]=mask;
		id++;
	}
}
bool second=true;
int decode (int n, int q, int h){
	h--;
	if(second) pos();
	second=false;
	if(pai[q]&(1<<h)) return 1;
	else return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...