답안 #83857

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
83857 2018-11-11T12:39:15 Z faceless 질문 (CEOI14_question_grader) C++14
컴파일 오류
0 ms 0 KB
int numbit (int mask) {
	int ret = 0;
	while (mask) {
		mask -= mask & -mask;
		ret ++;
	}
	return ret;
}

int to[2000];

int encoder (int n, int x, int y){
	int tmp = 1;
	for (int mask = 0; mask < (1 << 12); mask ++) {
		if (numbit (mask) == 6) {
			to[tmp ++] = mask;
		}
	}
	for (int i = 0; i < 12; i++) {
		if (to[x] & (1 << i) and (to[y] & (1 << i)) == 0)
			return i + 1;
	}
}
int numbit (int mask) {
	int ret = 0;
	while (mask) {
		mask -= mask & -mask;
		ret ++;
	}
	return ret;
}

int to[2000];

int decoder (int n, int q, int h){
	int tmp = 1;
	for (int mask = 0; mask < (1 << 12); mask ++) {
		if (numbit (mask) == 6) {
			to[tmp ++] = mask;
		}
	}

	int mask = to[q];
	if (mask & (1 << (h - 1)))
		return 1;
	return 0;
}

Compilation message

encoder.cpp: In function 'int encoder(int, int, int)':
encoder.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/tmp/ccegYaXc.o: In function `main':
grader_encode.c:(.text.startup+0x10a): undefined reference to `encode(int, int, int)'
collect2: error: ld returned 1 exit status

/tmp/ccDCEVIi.o: In function `main':
grader_decode.c:(.text.startup+0x19f): undefined reference to `decode(int, int, int)'
collect2: error: ld returned 1 exit status