Submission #260819

# Submission time Handle Problem Language Result Execution time Memory
260819 2020-08-11T04:19:50 Z arnold518 Airline Route Map (JOI18_airline) C++14
Compilation error
0 ms 0 KB
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
static const int MAXN = 1100;
 
static int V, U, *C, *D;
static vector<int> adj[MAXN+10];
static vector<int> radj[MAXN+10];
static int N, deg[MAXN+10], A[MAXN+10], B[MAXN+10];
static vector<pii> E;
static bool vis[MAXN+10];
static const int POW[10] = {1, 3, 9, 27, 81, 243, 729};
 
void Bob(int _V, int _U, int _C[], int _D[])
{
	V=_V; U=_U; C=_C; D=_D; N=V-12;
	for(int i=0; i<U; i++)
	{
		int u=C[i], v=D[i];
		adj[u].push_back(v);
		radj[v].push_back(u);
		deg[u]++; deg[v]++;
	}
 
	int P, Q, R;
	for(int i=0; i<V; i++) if(deg[i]==2) { P=i; break; }
	for(int i=0; i<V; i++) if(deg[i]==N+10) vis[i]=1;
	Q=adj[P].front(); R=radj[P].front();
	assert(adj[P].size()==1); assert(radj[P].size()==1);
	vis[P]=1; vis[Q]=1; vis[R]=1;
 
	vector<int> VV;
	for(auto it : adj[Q])
	{
		if(vis[it]) continue;
		VV.push_back(it);
		A[it]+=1;
	}
	for(auto it : radj[Q])
	{
		if(vis[it]) continue;
		VV.push_back(it);
		A[it]+=2;
	}
	for(auto it : adj[R])
	{
		if(vis[it]) continue;
		VV.push_back(it);
		A[it]+=3;
	}
	for(auto it : radj[R])
	{
		if(vis[it]) continue;
		VV.push_back(it);
		A[it]+=6;
	}
	sort(VV.begin(), VV.end());
	VV.erase(unique(VV.begin(), VV.end()), VV.end());
 	if(VV.size()!=7) while(1);

	for(auto it : VV)
	{
		vis[it]=1;
		B[A[it]-1]=it;
	}
 
	VV.clear();
	for(int i=0; i<7; i++)
	{
		for(auto it : adj[B[i]])
		{
			if(vis[it]) continue;
			VV.push_back(it);
			A[it]+=POW[i];
		}
		for(auto it : radj[B[i]])
		{
			if(vis[it]) continue;
			VV.push_back(it);
			A[it]+=POW[i]*2;
		}
	}
 
	sort(VV.begin(), VV.end());
	VV.erase(unique(VV.begin(), VV.end()), VV.end());
	if(VV.size()!=N) while(1);

	vector<int> VVV;
	for(auto it : VV) VVV.push_back(A[it]);
	sort(VVV.begin(), VVV.end());
	//for(int i=0; i<VVV.size(); i++) if(VVV[i]!=i+1) while(1);
 
	for(auto now : VV)
	{
		for(auto nxt : adj[now])
		{
			if(vis[nxt]) continue;
			E.push_back({A[now], A[nxt]});
		}
	}
 
	InitMap(N, E.size());
	for(auto it : E) MakeMap(it.first-1, it.second-1);
}



    

Compilation message

Alice.cpp: In function 'void Bob(int, int, int*, int*)':
Alice.cpp:91:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(VV.size()!=N) while(1);
     ~~~~~~~~~^~~
Alice.cpp:30:6: warning: 'P' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int P, Q, R;
      ^
/tmp/ccU7NeMZ.o: In function `main':
grader_alice.cpp:(.text.startup+0xe0): undefined reference to `Alice(int, int, int*, int*)'
/tmp/ccjBdzq0.o: In function `Bob(int, int, int*, int*)':
Alice.cpp:(.text+0xbe9): undefined reference to `InitMap(int, int)'
Alice.cpp:(.text+0xc0c): undefined reference to `MakeMap(int, int)'
collect2: error: ld returned 1 exit status

/tmp/cc7oYGaP.o: In function `main':
grader_bob.cpp:(.text.startup+0xd0): undefined reference to `Bob(int, int, int*, int*)'
collect2: error: ld returned 1 exit status