Submission #476855

# Submission time Handle Problem Language Result Execution time Memory
476855 2021-09-28T18:42:12 Z wiktoria_bazan Saveit (IOI10_saveit) C++14
Compilation error
0 ms 0 KB
#include "grader.h"
#include "encoder.h"
#include<vector>

int const N = 1e3 + 9;
int const H = 40;
int d[H][N];
bool odw[H][N];
vector<int> G[N];

void dfs(int v, int in, int w) {
    odw[in][v] = true;
    d[in][v] = w;
    for (int i = 0; i < G[v].size(); i++) {
        int sas = G[v][i];
        if (!odw[in][sas])
            dfs(sas, in, w + 1);
    }
}

void int_to_bits(int a) { //9 bitów
    int pot = 1 << 9;
    while (a > 0) {
        if (a > pot) {
            encode_bit(1);
            a -= pot;
        }
        else encode_bit(0);
        pot >>= 1;
    }
}


void encode(int nv, int nh, int ne, int* v1, int* v2) {
    for (int i = 0; i < ne; i++) {
        G[v1[i]].push_back(G[v2[i]]);
        G[v2[i]].push_back(G[v1[i]]);
    }
    for (int h = 0; h < nh; h++) {
        dfs(h, h, 0);
        for (int v = 0; v < nv; v++) {
            int_to_bits(d[h][v]);
        }
    }
    return;
}
#include "grader.h"
#include "decoder.h"
void decode(int nv, int nh) {
    for (int h = 0; h < nh; h++) {
        for (int v = 0; v < nv; v++) {
            int mn = 1;
            int a = 0;
            for (int i = 0; i < 9; i++) {
                int bit = decode_bit();
                a += bit * mn;
                mn <<= 2;
            }
            hops(h, v, a);
        }
    }
}

Compilation message

encoder.cpp:9:1: error: 'vector' does not name a type
    9 | vector<int> G[N];
      | ^~~~~~
encoder.cpp: In function 'void dfs(int, int, int)':
encoder.cpp:14:25: error: 'G' was not declared in this scope
   14 |     for (int i = 0; i < G[v].size(); i++) {
      |                         ^
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:36:9: error: 'G' was not declared in this scope
   36 |         G[v1[i]].push_back(G[v2[i]]);
      |         ^