Submission #476892

# Submission time Handle Problem Language Result Execution time Memory
476892 2021-09-29T00:20:09 Z wiktoria_bazan Saveit (IOI10_saveit) C++14
Compilation error
0 ms 0 KB
#include "grader.h"
#include "encoder.h"

#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;

int const INF = 1e6 + 9;
int const N = 1e3 + 9;
int const H = 40;
int d[H][N];
bool odw[H][N];
int G[N][N];
int R[N];
string p = "";
int index = 0;
queue<int>Q;

void bfs(int v, int in) {
    Q.push(v);
    odw[in][v] = 1;
    d[in][v] = 0;
    while (!Q.empty()) {
        v = Q.front();
        Q.pop();
        for (int i = 0; i < R[v]; i++) {
            int sas = G[v][i];
            if (!odw[in][sas]) {
                odw[in][sas] = 1;
                d[in][sas] = d[in][v] + 1;
                Q.push(sas);
            }
        }
    }
}

void int_to_bits(int a) { //9 bitów
    int t = 0;
    while (a > 0) {
        encode_bit(a % 2);
        a /= 2;
        t++;
    }
    while (t < 9) {
        encode_bit(0);
        t++;
    }
}


void encode(int nv, int nh, int ne, int* v1, int* v2) {
    for (int i = 0; i < ne; i++) {
        G[v1[i]][R[v1[i]]] = v2[i];
        R[v1[i]]++;
        G[v2[i]][R[v2[i]]] = v1[i];
        R[v2[i]]++;
    }
    for (int h = 0; h < nh; h++) {
        bfs(h, h);
        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 <<= 1;
            }
            //hops(h, v, a);
            cout << a << " ";
        }
        cout << "\n";
    }
}

Compilation message

decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:15:13: error: 'cout' was not declared in this scope
   15 |             cout << a << " ";
      |             ^~~~
decoder.cpp:17:9: error: 'cout' was not declared in this scope
   17 |         cout << "\n";
      |         ^~~~