Submission #849908

# Submission time Handle Problem Language Result Execution time Memory
849908 2023-09-15T14:34:19 Z Andrey Parrots (IOI11_parrots) C++14
Compilation error
0 ms 0 KB
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;

void encode(int n, int m[])
{
    vector<int> bruh(0);
    for(int i = 0; i < n; i++) {
        for(int j = 7; j >= 0; j--) {
            if((1 << j)&m[i]) {
                bruh.push_back(1);
            }
            else {
                bruh.push_back(0);
            }
        }
    }
    int br = 0;
    for(int i = 0; i < bruh.size(); i++) {
        if(bruh[i] == 0 && br < 256) {
            send(br);
        }
        else {
            br++;
        }
    }
}
#include "decoder.h"
#include "decoderlib.h"
using namespace std;

void decode(int n, int l, int x[])
{
    vector<int> br(256);
    for(int i = 0; i < l; i++) {
        br[x[i]]++;
    }
    vector<int> bruh(0);
    for(int i = 0; i < 256; i++) {
        for(int j = 0; j < br[i]; j++) {
            bruh.push_back(0);
        }
        bruh.push_back(1);
    }
    for(int i = 0; i < 10000; i++) {
        bruh.push_back(0);
    }
    int sb = 0;
    for(int i = 0; i < n; i++) {
        sb = 0;
        for(int j = i*8; j < (i+1)*8; j++) {
            sb*=2;
            sb+=bruh[j];
        }
        output(sb);
    }
}

Compilation message

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i = 0; i < bruh.size(); i++) {
      |                    ~~^~~~~~~~~~~~~

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:7:5: error: 'vector' was not declared in this scope
    7 |     vector<int> br(256);
      |     ^~~~~~
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 | using namespace std;
decoder.cpp:7:12: error: expected primary-expression before 'int'
    7 |     vector<int> br(256);
      |            ^~~
decoder.cpp:9:9: error: 'br' was not declared in this scope
    9 |         br[x[i]]++;
      |         ^~
decoder.cpp:11:12: error: expected primary-expression before 'int'
   11 |     vector<int> bruh(0);
      |            ^~~
decoder.cpp:13:28: error: 'br' was not declared in this scope
   13 |         for(int j = 0; j < br[i]; j++) {
      |                            ^~
decoder.cpp:14:13: error: 'bruh' was not declared in this scope
   14 |             bruh.push_back(0);
      |             ^~~~
decoder.cpp:16:9: error: 'bruh' was not declared in this scope
   16 |         bruh.push_back(1);
      |         ^~~~
decoder.cpp:19:9: error: 'bruh' was not declared in this scope
   19 |         bruh.push_back(0);
      |         ^~~~
decoder.cpp:26:17: error: 'bruh' was not declared in this scope
   26 |             sb+=bruh[j];
      |                 ^~~~