Submission #1260830

#TimeUsernameProblemLanguageResultExecution timeMemory
1260830niepamietamhaslaQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++20
100 / 100
713 ms39748 KiB
#include <bits/stdc++.h>
using namespace std;


vector<int> v1;

void obliczv1(){
	int c = 1;
	while(v1.size() < 921){
		if(__builtin_popcount(c) == 6) v1.push_back(c);
		c++;
	}
	return;
}

int encode(int n, int x, int y){
    obliczv1();
	int i1 = v1[x];
	int i2 = v1[y];
	for(int i = 0; i < 12; ++i){
		if((i1 & (1 << i)) and !(i2 & (1 << i))){
			return i + 1;
		}
	}
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

vector<int> v2;

void obliczv2(){
	int c = 1;
	while(v2.size() < 921){
		if(__builtin_popcount(c) == 6) v2.push_back(c);
		c++;
	}
	return;
}


int decode(int n, int q, int h){
    obliczv2();
	int licz = v2[q];
	h--;
	if(licz & (1 << h)){
		return 1;
	}
	else{
		return 0;
	}
	return -1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...