Submission #451574

# Submission time Handle Problem Language Result Execution time Memory
451574 2021-08-03T09:11:56 Z kingfran1907 Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
0 / 100
7000 ms 764 KB
#include <bits/stdc++.h>
using namespace std;

vector< int > vs[1000];
int encode (int n, int x, int y) {
	vector< int > v;
	for (int i = 0; i < 6; i++) v.push_back(0);
	for (int i = 0; i < 6; i++) v.push_back(1);
	
	int ptr = 0;
	do {
		vector< int > tren;
		for (int i = 0; i < 12; i++) {
			if (v[i] == 1) tren.push_back(i);
		}
		vs[ptr++] = tren;
	} while (next_permutation(v.begin(), v.end()));
	
	for (auto iter : vs[x]) {
		bool flag = true;
		for (auto tren : vs[y]) {
			if (iter == tren) flag = false;
		}
		if (flag) return iter + 1;
	}
}
#include <bits/stdc++.h>
using namespace std;

vector< int > vs[1000];
int decode (int n, int q, int h) {
	vector< int > v;
	for (int i = 0; i < 6; i++) v.push_back(0);
	for (int i = 0; i < 6; i++) v.push_back(1);
	
	int ptr = 0;
	do {
		vector< int > tren;
		for (int i = 0; i < 12; i++) {
			if (v[i] == 1) tren.push_back(i);
		}
		vs[ptr++] = tren;
	} while (next_permutation(v.begin(), v.end()));
	
	h--;
	for (int tren : vs[q]) 
		if (tren == h) return 1;
	return 0;
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:6:16: warning: control reaches end of non-void function [-Wreturn-type]
    6 |  vector< int > v;
      |                ^
# Verdict Execution time Memory Grader output
1 Execution timed out 7072 ms 764 KB Time limit exceeded
2 Execution timed out 7073 ms 708 KB Time limit exceeded