Submission #383995

# Submission time Handle Problem Language Result Execution time Memory
383995 2021-03-31T07:08:34 Z MODDI Saveit (IOI10_saveit) C++14
Compilation error
0 ms 0 KB
#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
using namespace std;
static int h[1000][1000], hcnt;

#define FOR(i,n) for (int i = 0; i < (n); i++)
void encode(int nv, int nh, int ne, int* v1, int* v2){
  //encode_bit(1);
  //encode_bit(0);
  int G[nv][nv];
  memset(G, 0, sizeof(G));
  for(int i = 0; i < ne; i++)
  	G[v1[i]][v2[i]] = 1;
  	
  	bool vis[nv][nv];
  	memset(vis, false, sizeof(vis));
	for(int i = 0; i < nv ;i++){
		for(int j = 0; j < nv; j++)
		{
			if(!vis[i][j] && !vis[j][i]){
				encode_bit(G[i][j]);
				//cout<<G[i][j]<<" ";
				vis[i][j] = true;
				vis[j][i] = true;
			}
			else
				continue;
		}
		cout<<endl;
	}
  return;
}
//#include "grader.h"
//#include "decoder.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define mp make_pair
#define pb push_back
using namespace std;
void decode(int nv, int nh) {
   //int a = decode_bit();
   //int b = decode_bit();
   //hops(0,0,0);
   //hops(1,2,3);
   int G[nv][nv];
   bool vis[nv][nv];
   memset(vis, false, sizeof(vis));
   for(int i = 0; i < nv; i++){
   		for(int j = 0; j < nv; j++){
   			//cout<<"HERE"<<endl;
   			if(vis[i][j] && vis[j][i])	continue;
   			else{
   				G[i][j] = decode_bit();
   				vis[i][j] = true;
   				vis[j][i] = true;
   				G[j][i] = G[i][j];
   				//cout<<G[i][j]<<" ";
			   }
		   }
   	}	
   	for(int i = 0; i < nh; i++){
   		queue<pii> q;
   		q.push(mp(i, 0));
		int dist[nv];
		for(int j = 0; j < nv; j++)
			dist[j] = 1e9;
			
		dist[i] = 0;
		bool visited[nv];
		memset(visited, false, sizeof(visited));
		while(!q.empty()){
			pii at = q.front(); q.pop();
			//cout<<at.first<<" "<<at.second<<endl;
			for(int j = 0; j < nv; j++){
				if(!visited[j] && G[at.first][j] == 1){
					visited[j] = true;
					dist[j] = min(dist[j], 1 + dist[at.first]);
					q.push(mp(j, at.second + 1));
				}
			}
		}
		for(int j = 0; j < nv; j++){
			hops(i, j, dist[j]);
			//cout<<dist[j]<<" ";
		}
		//cout<<endl;
	   }
}

Compilation message

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:20:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   20 |   for(int i = 0; i < ne; i++)
      |   ^~~
encoder.cpp:23:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   23 |    bool vis[nv][nv];
      |    ^~~~
encoder.cpp: At global scope:
encoder.cpp:12:27: warning: 'hcnt' defined but not used [-Wunused-variable]
   12 | static int h[1000][1000], hcnt;
      |                           ^~~~
encoder.cpp:12:12: warning: 'h' defined but not used [-Wunused-variable]
   12 | static int h[1000][1000], hcnt;
      |            ^

decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:25:18: error: 'decode_bit' was not declared in this scope; did you mean 'decode'?
   25 |        G[i][j] = decode_bit();
      |                  ^~~~~~~~~~
      |                  decode
decoder.cpp:55:4: error: 'hops' was not declared in this scope
   55 |    hops(i, j, dist[j]);
      |    ^~~~