답안 #451578

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
451578 2021-08-03T09:17:23 Z kingfran1907 질문 (CEOI14_question_grader) C++14
0 / 100
7000 ms 2276 KB
#include <bits/stdc++.h>
using namespace std;

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 {
		int tren = 0;
		for (int i = 0; i < 12; i++) {
			if (v[i] == 1) tren |= (1 << i);
		}
		vs[ptr++] = tren;
	} while (next_permutation(v.begin(), v.end()));
	
	for (int i = 0; i < 12; i++) {
		if ((vs[x] & (1 << i)) && !(vs[y] & (1 << i))) {
			return i + 1;
		}
	}
}
#include <bits/stdc++.h>
using namespace std;

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 {
		int tren = 0;
		for (int i = 0; i < 12; i++) {
			if (v[i] == 1) tren |= (1 << i);
		}
		vs[ptr++] = tren;
	} while (next_permutation(v.begin(), v.end()));
	
	h--;
	if (vs[q] & (1 << 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;
      |                ^
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 7090 ms 2276 KB Time limit exceeded
2 Execution timed out 7029 ms 2072 KB Time limit exceeded