Submission #65837

#TimeUsernameProblemLanguageResultExecution timeMemory
65837josw530Parrots (IOI11_parrots)C++98
Compilation error
0 ms0 KiB
#include "encoder.h"
#include "encoderlib.h"

int BIT_MASK[8] = {
	0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
};

void encode(int N, int M[])
{
  int i;
  
  
  for(i=0; i<N; i++)
  {
	  for(int j = 0; j<8; j++)
	  {
		  if(M[i]&BIT_MASK[j])
			send(i*8 + j);  
	  }
	
  }
    
}
#include "decoder.h"
#include "decoderlib.h"

int BIT_MASK[8] = {
	0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
};

void decode(int N, int L, int X[])
{
  int i, b;
  int msg[32] = {0};
  for(i=0; i<L; i++) {
    msg[X[i]/8] |= BIT_MASK[(X[i]%8];
  }

    for(i=0; i<N; i++) {
    output(msg[i]);
  }
 }

Compilation message (stderr)

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:13:36: error: expected ')' before ']' token
     msg[X[i]/8] |= BIT_MASK[(X[i]%8];
                                    ^
decoder.cpp:13:37: error: expected ']' before ';' token
     msg[X[i]/8] |= BIT_MASK[(X[i]%8];
                                     ^
decoder.cpp:10:10: warning: unused variable 'b' [-Wunused-variable]
   int i, b;
          ^