Submission #316554

# Submission time Handle Problem Language Result Execution time Memory
316554 2020-10-26T16:16:35 Z bigg Airline Route Map (JOI18_airline) C++14
Compilation error
0 ms 0 KB

      
#include "Boblib.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
static vector<int> vgrafo[1505], auxbin[1505];
static vector<pair<int, int> > grafo;
static int marc1[1505][1505];
static int marc[1505], whichbin[1505], whichr[1505];
static std::vector<int> bin;

void Bob( int V, int U, int C[], int D[] ){

	int aux1, aux2, auxaux1 = 0;
	for(int i = 0; i < U; i++){
		//printf("%d %d\n",C[i], D[i] );
		vgrafo[C[i]].push_back(D[i]);
		vgrafo[D[i]].push_back(C[i]);
		if(vgrafo[D[i]].size() > auxaux1){
			aux1 = D[i];
			auxaux1 = vgrafo[D[i]].size();
		}
		if(vgrafo[C[i]].size() > auxaux1){
			aux1 = C[i];
			auxaux1 = vgrafo[C[i]].size();
		}
	}

	int n = V - 12;
	for(int i = 0; i < V; i++){
		if(i == aux1) continue;
		bool ok = 1; 
		for(auto u : vgrafo[i]){
			if(u == aux1) ok = 0;
		}
		if(ok){
			aux2 = i;
			break;
		}
	}
	//printf("%d %d\n", aux1, aux2);
	for(auto u : vgrafo[aux2]){
		marc[u] = 1;
	}
	int b0;
	for(auto u : vgrafo[aux2]){
		for(auto v : vgrafo[u]){
			if(!marc[v]) continue;
			auxbin[u].push_back(v);
		}
		if(auxbin[u].size() == 1) b0 = u;
	}
		//printf("Chegueiaqui!\n");
	int r0 = b0;
	for(int i = 0; i < 10; i++){
		bin.push_back(b0);
		whichbin[b0] = i;
		if(i == 0) b0 = auxbin[b0][0];
		else if(i == 1){
			for(auto u : auxbin[b0]){
				if(whichbin[u] == r0) continue;
				if(auxbin[u].size() > 2) continue;
				b0 = u;
				break;
			}
		}else if(i == 3){
			for(auto u : auxbin[b0]){
				if(whichbin[u] == i - 1) continue;
				if(auxbin[u].size() > 2) continue;
				b0 = u;
				break;
			}
		}else{
			for(auto u : auxbin[b0]){
				if(whichbin[u] == i - 1) continue;
				b0 = u;
				break;
			}
		}
	}	
	for(int i = 0; i < 10; i++){
		int x = bin[i];
		for(auto u : vgrafo[x]){
			if(auxbin[u].size() > 0 )continue;
			if(u == aux1) continue;
			if(u == aux2) continue;
			whichr[u] |= (1<<i);
			//printf("%d %d\n",i, whichr[u] );
		}
	}
	for(int i = 0; i < V; i++){
		if(i == aux1 || i == aux2) continue;
		if(auxbin[i].size() > 0) continue;
		for(auto u : vgrafo[i]){
			if( u == aux1 || u == aux2 ) continue;
			if(auxbin[u].size() > 0) continue;
			if(!marc1[i][u]){
				grafo.push_back(make_pair(whichr[i], whichr[u]));
			}
			marc1[i][u] = 1;
			marc1[u][i] = 1;

		}
	}



	InitMap(n, grafo.size());
	for(int i = 0; i < grafo.size(); i++){
		MakeMap(grafo[i].first, grafo[i].second);
	}

}

Compilation message

/tmp/cc93TCFU.o: In function `main':
grader_alice.cpp:(.text.startup+0xe3): undefined reference to `Alice(int, int, int*, int*)'
collect2: error: ld returned 1 exit status

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:18:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |   if(vgrafo[D[i]].size() > auxaux1){
      |      ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
Bob.cpp:22:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |   if(vgrafo[C[i]].size() > auxaux1){
      |      ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
Bob.cpp:108:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  108 |  for(int i = 0; i < grafo.size(); i++){
      |                 ~~^~~~~~~~~~~~~~
Bob.cpp:13:12: warning: 'aux2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 |  int aux1, aux2, auxaux1 = 0;
      |            ^~~~
Bob.cpp:94:10: warning: 'aux1' may be used uninitialized in this function [-Wmaybe-uninitialized]
   94 |    if( u == aux1 || u == aux2 ) continue;
      |        ~~^~~~~~~