Submission #934664

# Submission time Handle Problem Language Result Execution time Memory
934664 2024-02-27T18:51:46 Z tamyte Parrots (IOI11_parrots) C++14
Compilation error
0 ms 0 KB
#include "encoder.h"
#include "encoderlib.h"

void encode(int N, int M[])
{
  int i;
  for(i=0; i<N; i++) {
    int now = i + (M[i] << 3);
    send(now);
  }
}
#include "decoder.h"
#include "decoderlib.h"

void decode(int N, int L, int X[])
{
  int i;
  std::vector<int> res(N);
  for(i=0; i<L; i++) {
    int num = 0;
    for (int j = (1 << 3); j <= X[i]; j <<= 1) {
        if (j & X[i]) {
            num += (j >> 3);
        }
    }
    int idx = 0;
    for (int j = 0; j < 3; ++j) {
        if ((1 << j) & X[i]) {
            idx += (1 << j);
        }
    }
//    std::cout << idx << " " << num << " <- " << X[i] << "\n";
    res[idx] = num;
  }
  for (int i = 0; i < N; ++i) {
    output(res[i]);
  }
}

Compilation message

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:7:8: error: 'vector' is not a member of 'std'
    7 |   std::vector<int> res(N);
      |        ^~~~~~
decoder.cpp:3:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    2 | #include "decoderlib.h"
  +++ |+#include <vector>
    3 | 
decoder.cpp:7:15: error: expected primary-expression before 'int'
    7 |   std::vector<int> res(N);
      |               ^~~
decoder.cpp:22:5: error: 'res' was not declared in this scope
   22 |     res[idx] = num;
      |     ^~~
decoder.cpp:25:12: error: 'res' was not declared in this scope
   25 |     output(res[i]);
      |            ^~~