Submission #151983

#TimeUsernameProblemLanguageResultExecution timeMemory
151983emaborevkovicQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>

using namespace std;

#define pb push_back

int a[15];
vector <int> v[930];
int brr;
int b[15];

void prek (int pos) {
	if (pos == 12) {
		int br = 0;
		for (int i=0;i<12;i++) br+=a[i];
		if (br != 6) return;
		for (int i=0;i<12;i++) {
			if (a[i]) v[brr].pb(i);
		}
		brr++;
		return;
	}
	a[pos] = 1;
	prek (pos+1);
	a[pos] = 0;
	prek (pos+1);
}

int encode (int n, int x, int y) {
	prek(0);
	x--; y--;
	for (int i=0;i<6;i++) {
		b[v[x][i]]++;
		b[v[y][i]]--;
	}
	for (int i=0;i<12;i++) {
		if (b[i] == 1) return i+1;
	}
}
/*
int main() {
	int n, x, y;
	cin >> n >> x >> y;
	cout << encode(n, x, y);
}
*/
#include <iostream>
#include <vector>

using namespace std;

#define pb push_back

int a[15];
vector <int> v[930];
int brr;
int b[15];

void prek (int pos) {
	if (pos == 12) {
		int br = 0;
		for (int i=0;i<12;i++) br+=a[i];
		if (br != 6) return;
		for (int i=0;i<12;i++) {
			if (a[i]) v[brr].pb(i);
		}
		brr++;
		return;
	}
	a[pos] = 1;
	prek (pos+1);
	a[pos] = 0;
	prek (pos+1);
}

string decode (int n, int q, int h) {
	prek(0);
	q--; h--;
	for (int i=0;i<6;i++) {
		if (v[q][i] == h) return "yes";
	}
	return "no";
}
/*
int main() {
	int n, q, h;
	cin >> n >> q >> h;
	cout << decode(n, q, h);
}
*/

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

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