답안 #44618

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
44618 2018-04-03T22:07:49 Z MatheusLealV 질문 (CEOI14_question_grader) C++17
0 / 100
6 ms 968 KB
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef pair<int, int> pii;

int g = 0, Nmax = 0;

vector<int> v;

int encode (int n, int x, int y)
{
	v.clear();
	
 	for(int val = 1; val < (1<<12); val ++)
	{
		int l = 0, r = 0;

		for(int bit = 0; bit < 12; bit ++)
		{
			if(val & (1<<bit))
			{
				if(bit < 6) l++;

				else r ++;
			}
		}

		if(l == r) v.push_back(val);
	}

    x = v[x], y = v[y];

    for(int bit = 0; bit < 12; bit ++)
    {
    	if( (x & (1<<bit)) && !(y & (1<<bit))) return bit;
    }
}
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef pair<int, int> pii;

int g = 0, Nmax = 0;

vector<int> v;

int decode (int n, int q, int h)
{
	v.clear();

	for(int val = 1; val < (1<<12); val ++)
	{
		int l = 0, r = 0;

		for(int bit = 0; bit < 12; bit ++)
		{
			if(val & (1<<bit))
			{
				if(bit < 6) l++;

				else r ++;
			}
		}

		if(l == r) v.push_back(val);
	}

	int val = v[q];

    if(val & (1<<h)) return 1;

    return 0;
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:38:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 616 KB Output isn't correct
2 Incorrect 6 ms 968 KB Output isn't correct