Submission #583306

#TimeUsernameProblemLanguageResultExecution timeMemory
583306M_WSaveit (IOI10_saveit)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "encoder.h" #define ii pair<int, int> using namespace std; void encode(int nv, int nh, int ne, int *v1, int *v2){ vector<int> adj[1001]; for(int i = 0; i < ne; i++){ adj[v1[i]].push_back(v2[i]); adj[v2[i]].push_back(v1[i]); } int dist[36][1001]; bool vis[1001]; for(int i = 0; i < nh; i++){ memset(vis, 0, sizeof vis); queue<ii> q; q.push({i, 0}); vis[i] = true; while(!q.empty()){ auto [n, w] = q.front(); q.pop(); dist[i][n] = w; for(auto x : adj[n]){ if(vis[x]) continue; vis[x] = true; q.push({x, w + 1}); } } } for(int i = 0; i < nh; i++){ for(int j = 0; j < nv; j++){ for(int k = 0; k < 10; k++){ if(dist[i][j] & (1 << k)) encode_bit(1); else encode_bit(0); } } } return; } #include "decoder.h" void decode(int nv, int nh) { for(int i = 0; i < nh; i++){ for(int j = 0; j < nv; j++){ int ans = 0; for(int k = 0; k < 10; k++){ if(decode_bit()) ans += (1 << k); } hops(i, j, ans); } } }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:37:32: error: 'encode_bit' was not declared in this scope; did you mean 'encode'?
   37 |      if(dist[i][j] & (1 << k)) encode_bit(1);
      |                                ^~~~~~~~~~
      |                                encode
encoder.cpp:38:11: error: 'encode_bit' was not declared in this scope; did you mean 'encode'?
   38 |      else encode_bit(0);
      |           ^~~~~~~~~~
      |           encode
encoder.cpp: In function 'void decode(int, int)':
encoder.cpp:51:9: error: 'decode_bit' was not declared in this scope; did you mean 'decode'?
   51 |      if(decode_bit()) ans += (1 << k);
      |         ^~~~~~~~~~
      |         decode
encoder.cpp:53:3: error: 'hops' was not declared in this scope
   53 |   hops(i, j, ans);
      |   ^~~~

/usr/bin/ld: /tmp/cc6nmQwe.o: in function `main':
grader_decoder.c:(.text.startup+0x126): undefined reference to `decode(int, int)'
collect2: error: ld returned 1 exit status