Submission #476864

# Submission time Handle Problem Language Result Execution time Memory
476864 2021-09-28T18:57:14 Z wiktoria_bazan Saveit (IOI10_saveit) C++14
0 / 100
367 ms 69152 KB
#include "grader.h"
#include "encoder.h"

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

void dfs(int v, int in, int w) {
    odw[in][v] = true;
    d[in][v] = w;
    for (int i = 0; i < R[v]; 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 t = 0;
  while(a > 0){
      encode_bit(a % 2);
      a /= 2;
      t++;
  }
  while(t < 9){
    encode_bit(0);
  }
}


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++) {
        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);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 367 ms 69152 KB too many calls to encode_bit(b) function
2 Incorrect 79 ms 63116 KB too many calls to encode_bit(b) function
3 Incorrect 145 ms 66996 KB too many calls to encode_bit(b) function
4 Incorrect 77 ms 63112 KB too many calls to encode_bit(b) function
5 Incorrect 83 ms 66892 KB too many calls to encode_bit(b) function
6 Incorrect 85 ms 67284 KB too many calls to encode_bit(b) function
7 Incorrect 113 ms 67432 KB too many calls to encode_bit(b) function
8 Incorrect 85 ms 67092 KB too many calls to encode_bit(b) function
9 Incorrect 83 ms 67172 KB too many calls to encode_bit(b) function
10 Incorrect 150 ms 67172 KB too many calls to encode_bit(b) function
11 Incorrect 87 ms 67192 KB too many calls to encode_bit(b) function
12 Incorrect 84 ms 67168 KB too many calls to encode_bit(b) function
13 Incorrect 106 ms 67512 KB too many calls to encode_bit(b) function
14 Incorrect 84 ms 67356 KB too many calls to encode_bit(b) function
15 Incorrect 88 ms 67460 KB too many calls to encode_bit(b) function
16 Incorrect 117 ms 67480 KB too many calls to encode_bit(b) function
17 Incorrect 96 ms 67484 KB too many calls to encode_bit(b) function
18 Incorrect 125 ms 67552 KB too many calls to encode_bit(b) function
19 Incorrect 90 ms 67372 KB too many calls to encode_bit(b) function
20 Incorrect 121 ms 67592 KB too many calls to encode_bit(b) function
21 Incorrect 185 ms 67860 KB too many calls to encode_bit(b) function
22 Incorrect 118 ms 67464 KB too many calls to encode_bit(b) function
23 Incorrect 135 ms 67892 KB too many calls to encode_bit(b) function
# Verdict Execution time Memory Grader output
1 Incorrect 367 ms 69152 KB too many calls to encode_bit(b) function
2 Incorrect 79 ms 63116 KB too many calls to encode_bit(b) function
3 Incorrect 145 ms 66996 KB too many calls to encode_bit(b) function
4 Incorrect 77 ms 63112 KB too many calls to encode_bit(b) function
5 Incorrect 83 ms 66892 KB too many calls to encode_bit(b) function
6 Incorrect 85 ms 67284 KB too many calls to encode_bit(b) function
7 Incorrect 113 ms 67432 KB too many calls to encode_bit(b) function
8 Incorrect 85 ms 67092 KB too many calls to encode_bit(b) function
9 Incorrect 83 ms 67172 KB too many calls to encode_bit(b) function
10 Incorrect 150 ms 67172 KB too many calls to encode_bit(b) function
11 Incorrect 87 ms 67192 KB too many calls to encode_bit(b) function
12 Incorrect 84 ms 67168 KB too many calls to encode_bit(b) function
13 Incorrect 106 ms 67512 KB too many calls to encode_bit(b) function
14 Incorrect 84 ms 67356 KB too many calls to encode_bit(b) function
15 Incorrect 88 ms 67460 KB too many calls to encode_bit(b) function
16 Incorrect 117 ms 67480 KB too many calls to encode_bit(b) function
17 Incorrect 96 ms 67484 KB too many calls to encode_bit(b) function
18 Incorrect 125 ms 67552 KB too many calls to encode_bit(b) function
19 Incorrect 90 ms 67372 KB too many calls to encode_bit(b) function
20 Incorrect 121 ms 67592 KB too many calls to encode_bit(b) function
21 Incorrect 185 ms 67860 KB too many calls to encode_bit(b) function
22 Incorrect 118 ms 67464 KB too many calls to encode_bit(b) function
23 Incorrect 135 ms 67892 KB too many calls to encode_bit(b) function
# Verdict Execution time Memory Grader output
1 Incorrect 367 ms 69152 KB too many calls to encode_bit(b) function
2 Incorrect 79 ms 63116 KB too many calls to encode_bit(b) function
3 Incorrect 145 ms 66996 KB too many calls to encode_bit(b) function
4 Incorrect 77 ms 63112 KB too many calls to encode_bit(b) function
5 Incorrect 83 ms 66892 KB too many calls to encode_bit(b) function
6 Incorrect 85 ms 67284 KB too many calls to encode_bit(b) function
7 Incorrect 113 ms 67432 KB too many calls to encode_bit(b) function
8 Incorrect 85 ms 67092 KB too many calls to encode_bit(b) function
9 Incorrect 83 ms 67172 KB too many calls to encode_bit(b) function
10 Incorrect 150 ms 67172 KB too many calls to encode_bit(b) function
11 Incorrect 87 ms 67192 KB too many calls to encode_bit(b) function
12 Incorrect 84 ms 67168 KB too many calls to encode_bit(b) function
13 Incorrect 106 ms 67512 KB too many calls to encode_bit(b) function
14 Incorrect 84 ms 67356 KB too many calls to encode_bit(b) function
15 Incorrect 88 ms 67460 KB too many calls to encode_bit(b) function
16 Incorrect 117 ms 67480 KB too many calls to encode_bit(b) function
17 Incorrect 96 ms 67484 KB too many calls to encode_bit(b) function
18 Incorrect 125 ms 67552 KB too many calls to encode_bit(b) function
19 Incorrect 90 ms 67372 KB too many calls to encode_bit(b) function
20 Incorrect 121 ms 67592 KB too many calls to encode_bit(b) function
21 Incorrect 185 ms 67860 KB too many calls to encode_bit(b) function
22 Incorrect 118 ms 67464 KB too many calls to encode_bit(b) function
23 Incorrect 135 ms 67892 KB too many calls to encode_bit(b) function
# Verdict Execution time Memory Grader output
1 Incorrect 367 ms 69152 KB too many calls to encode_bit(b) function
2 Incorrect 79 ms 63116 KB too many calls to encode_bit(b) function
3 Incorrect 145 ms 66996 KB too many calls to encode_bit(b) function
4 Incorrect 77 ms 63112 KB too many calls to encode_bit(b) function
5 Incorrect 83 ms 66892 KB too many calls to encode_bit(b) function
6 Incorrect 85 ms 67284 KB too many calls to encode_bit(b) function
7 Incorrect 113 ms 67432 KB too many calls to encode_bit(b) function
8 Incorrect 85 ms 67092 KB too many calls to encode_bit(b) function
9 Incorrect 83 ms 67172 KB too many calls to encode_bit(b) function
10 Incorrect 150 ms 67172 KB too many calls to encode_bit(b) function
11 Incorrect 87 ms 67192 KB too many calls to encode_bit(b) function
12 Incorrect 84 ms 67168 KB too many calls to encode_bit(b) function
13 Incorrect 106 ms 67512 KB too many calls to encode_bit(b) function
14 Incorrect 84 ms 67356 KB too many calls to encode_bit(b) function
15 Incorrect 88 ms 67460 KB too many calls to encode_bit(b) function
16 Incorrect 117 ms 67480 KB too many calls to encode_bit(b) function
17 Incorrect 96 ms 67484 KB too many calls to encode_bit(b) function
18 Incorrect 125 ms 67552 KB too many calls to encode_bit(b) function
19 Incorrect 90 ms 67372 KB too many calls to encode_bit(b) function
20 Incorrect 121 ms 67592 KB too many calls to encode_bit(b) function
21 Incorrect 185 ms 67860 KB too many calls to encode_bit(b) function
22 Incorrect 118 ms 67464 KB too many calls to encode_bit(b) function
23 Incorrect 135 ms 67892 KB too many calls to encode_bit(b) function