Submission #100968

# Submission time Handle Problem Language Result Execution time Memory
100968 2019-03-15T14:07:42 Z square1001 Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
0 / 100
1627 ms 263168 KB
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
static bool first_encode = true;
vector<vector<int> > perm_encode;
int encode(int n, int x, int y) {
	if (first_encode) {
		string perm = string(7, 'o') + string(7, 'x');
		do {
			vector<int> v;
			for (int i = 0; i < 14; ++i) {
				if (perm[i] == 'o') v.push_back(i);
			}
			perm_encode.push_back(v);
		} while (next_permutation(perm.begin(), perm.end()));
	}
	vector<int> a = perm_encode[x];
	vector<int> b = perm_encode[y];
	for (int i : a) {
		if (find(b.begin(), b.end(), i) == b.end()) {
			return i + 1;
		}
	}
	return -1;
}
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
static bool first_decode = true;
vector<vector<int> > perm_decode;
int decode(int n, int q, int h) {
	if (first_decode) {
		string perm = string(7, 'o') + string(7, 'x');
		do {
			vector<int> v;
			for (int i = 0; i < 14; ++i) {
				if (perm[i] == 'o') v.push_back(i);
			}
			perm_decode.push_back(v);
		} while (next_permutation(perm.begin(), perm.end()));
	}
	vector<int> a = perm_decode[q];
	if (find(a.begin(), a.end(), h - 1) != a.end()) return 1;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1627 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 1459 ms 263168 KB Execution killed with signal 9 (could be triggered by violating memory limits)