Submission #583307

# Submission time Handle Problem Language Result Execution time Memory
583307 2022-06-25T08:25:09 Z M_W Saveit (IOI10_saveit) C++17
Compilation error
0 ms 0 KB
#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 <bits/stdc++.h>
#include "encoder.h"
#define ii pair<int, int>
using namespace std;

#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

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

decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:12:9: error: 'decode_bit' was not declared in this scope; did you mean 'decode'?
   12 |      if(decode_bit()) ans += (1 << k);
      |         ^~~~~~~~~~
      |         decode
decoder.cpp:14:3: error: 'hops' was not declared in this scope
   14 |   hops(i, j, ans);
      |   ^~~~