Submission #1235273

#TimeUsernameProblemLanguageResultExecution timeMemory
1235273pcpParrots (IOI11_parrots)C++20
Compilation error
0 ms0 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <math.h>
#include <iostream>
#include <vector>

using namespace std;



void encode(int N, int M[])
{
  int i;
  for(i=0; i<N-1; i++){
    int b = M[i];
    bool wm=true;
    for (int j = 6;j >= 0;--j){
      if (j==5 &&wm){
        j=6;wm=false;
      }
      int x = pow(2,j);
      if (x <= b){
        b-=x;
        send(j + i*8);
      }
    }

  }

  send(M[N-1]);
    
}
#include "decoder.h"
#include "decoderlib.h"
#include <math.h>
#include <iostream>
#include <vector>


using namespace std;

void decode(int N, int L, int X[])
{
  int i, b;

  vector<int> msg(N,0);

  short int stuff[256];
  memset(stuff, 0, sizeof stuff);

  for(i=0; i<L; i++) {
    b = X[i] ;
    int f=pow(2,(b%8));
    stuff[b]+=1;

    if ( (stuff[b] > 1 && b%8!=6) || (stuff[b]>2 &&b%8==6) )msg[N-1]=b;
    else msg[b/8] += f;

  }

  for (int c : msg)output(c);
}

Compilation message (stderr)

# 2번째 컴파일 단계

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:17:3: error: 'memset' was not declared in this scope
   17 |   memset(stuff, 0, sizeof stuff);
      |   ^~~~~~
decoder.cpp:6:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    5 | #include <vector>
  +++ |+#include <cstring>
    6 |