Submission #44626

#TimeUsernameProblemLanguageResultExecution timeMemory
44626wzyQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++11
100 / 100
1889 ms79328 KiB
#include <bits/stdc++.h>
using namespace std;
vector<int> v;

void putmask(){
	if(v.size()) return ;
	for(int j = 0 ; j < (1<<12) ; j++){
		int x = 0;
		for(int i = 0 ; i < 12 ; i++){
			if(1<<i & j) x++; 
		}
		if(x == 6){
			v.push_back(j);
		}
	}
}


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

void putmask(){
	if(v.size()) return ;
	for(int j = 0 ; j < (1<<12) ; j++){
		int x = 0;
		for(int i = 0 ; i < 12 ; i++){
			if(1<<i & j) x++; 
		}
		if(x == 6){
			v.push_back(j);
		}
	}
}



int decode (int n, int q, int h) {
	putmask();
	h--;
	if(v[q] & 1<<h){
		return 1;
	}
	else return 0;
}

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...