답안 #110575

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110575 2019-05-11T08:30:59 Z MAMBA 질문 (CEOI14_question_grader) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define rep(i , j , k) for (int i = j; i < k; i++)

bool init = false;

constexpr int N = 1000;

int arr[N][6], ptr, ptr2, local[6];

void generate(int me = 0) {
	if (me == 12) {
		if (ptr != 6) return;
		memcpy(arr[ptr2++] , local, sizeof(local));
		return;
	}
	if (ptr < 6) {
		local[ptr++] = me;
		generate(me + 1);
		ptr--;
	}
	generate(me + 1);
}

int decoder(int junk , int q, int h) {
	if (!init) {
		generate();
		init = true;
	}
	rep(i , 0 , 6)
		if (arr[q][i] == h)
			return true;
	return false;
}

int encoder(int junk, int x, int y) {
	if (!init) {
		generate();
		init = true;
	}
	rep(i , 0 , 6)
		if (arr[x][i] != arr[y][i])
			return i + 1;
}
#include <bits/stdc++.h>

using namespace std;

#define rep(i , j , k) for (int i = j; i < k; i++)

bool init = false;

constexpr int N = 1000;

int arr[N][6], ptr, ptr2, local[6];

void generate(int me = 0) {
	if (me == 12) {
		if (ptr != 6) return;
		memcpy(arr[ptr2++] , local, sizeof(local));
		return;
	}
	if (ptr < 6) {
		local[ptr++] = me;
		generate(me + 1);
		ptr--;
	}
	generate(me + 1);
}

int decoder(int junk , int q, int h) {
	if (!init) {
		generate();
		init = true;
	}
	rep(i , 0 , 6)
		if (arr[q][i] == h)
			return true;
	return false;
}

int encoder(int junk, int x, int y) {
	if (!init) {
		generate();
		init = true;
	}
	rep(i , 0 , 6)
		if (arr[x][i] != arr[y][i])
			return i + 1;
}

Compilation message

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

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