답안 #292598

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
292598 2020-09-07T10:36:49 Z Berted Broken Device (JOI17_broken_device) C++14
컴파일 오류
0 ms 0 KB
#include "anna.h"
#include <iostream>

using namespace std;

/*
	Translation Table :
	000 -> No info.
	001 -> 0
	010 -> 1
	011 -> 10
	100 -> 00
	101 -> 1
	110 -> 01
	111 -> 11

	Main idea :
	- Split into blocks of size 3
	- If more than one bit is broke, you can do nothing
	- If one bit is broke, send at least 1 bits of information
	- If none is broke, send at least 2 bits of information
*/

int s[151];

void Anna(int N, long long X, int K, int P[])
{
	for (int i = 0; i < N; i++) {s[i] = 0;}
	for (int i = 0; i < K; i++) {s[P[i]] = 1;}
	for (int i = 0; i < N; i += 3)
	{
		int cnt = s[i] + s[i + 1] + s[i + 2];
		if (cnt > 1) {Set(i, 0); Set(i + 1, 0); Set(i + 2, 0);}
		else if (s[i])
		{
			Set(i, 0);
			if (X & 1) {Set(i + 1, 1); Set(i + 2, 0);}
			else {Set(i + 1, 0); Set(i + 2, 1);} 
			X >>= 1;
		}
		else if (s[i + 1])
		{
			Set(i + 1, 0);
			if (X & 1) {Set(i, 1); Set(i + 2, 1);}
			else {Set(i, 0); Set(i + 2, 1);}
			X >>= 1;
		}
		else if (s[i + 2])
		{
			Set(i + 2, 0);
			if (X & 1) {Set(i, 0); Set(i + 1, 1); X >>= 1;}
			else if (X & 3) {Set(i, 1); Set(i + 1, 1); X >>= 2;}
			else {Set(i, 1); Set(i + 1, 0); X >>= 2;}
		}
		else
		{
			if ((X & 3) == 0) {Set(i, 1); Set(i + 1, 0); Set(i + 2, 0);}
			else if ((X & 3) == 1) {Set(i, 1); Set(i + 1, 1); Set(i + 2, 0);}
			else if ((X & 3) == 2) {Set(i, 0); Set(i + 1, 1); Set(i + 2, 1);}
			else {Set(i, 1); Set(i + 1, 1); Set(i + 2, 1);}
			X >>= 2;
		}
	}
}
#include "bruno.h"

long long Bruno(int N, int A[])
{
	long long res = 0, k = 1;
	for (int i = 0; i < N; i += 3)
	{
		int val = A[i] << 2 | A[i + 1] << 1 | A[i + 2];
		if (val == 1) {k <<= 1;}
		else if (val == 2) {res |= 1 * k; k <<= 1;}
		else if (val == 3) {res |= 1 * k; k <<= 2;}
		else if (val == 4) {k <<= 2;}
		else if (val == 5) {res |= 1 * k; k <<= 1;}
		else if (val == 6) {res |= 2 * k; k <<= 2;}
		else if (val == 7) {res |= 3 * k; k <<= 2;}
	}
	return res;
}

Compilation message

Anna.cpp:1:10: fatal error: anna.h: No such file or directory
    1 | #include "anna.h"
      |          ^~~~~~~~
compilation terminated.

Bruno.cpp:1:10: fatal error: bruno.h: No such file or directory
    1 | #include "bruno.h"
      |          ^~~~~~~~~
compilation terminated.