답안 #62952

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62952 2018-07-31T03:34:31 Z qkxwsm 항공 노선도 (JOI18_airline) C++17
컴파일 오류
0 ms 0 KB
#include "Boblib.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

struct chash
{
        int operator()(int x) const
        {
                x ^= (x >> 20) ^ (x >> 12);
                return x ^ (x >> 7) ^ (x >> 4);
        }
        int operator()(long long x) const
        {
                return x ^ (x >> 32);
        }
};

template<typename T> using orderedset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename U> using hashtable = gp_hash_table<T, U, chash>;

template<class T>
void readi(T &x)
{
	T input = 0;
	bool negative = false;
	char c = ' ';
	while (c < '-')
        {
		c = getchar();
	}
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = input * 10 + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	x = input;
}
template<class T>
void printi(T output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
template<class T>
void ckmin(T &a, T b)
{
	a = min(a, b);
}
template<class T>
void ckmax(T &a, T b)
{
	a = max(a, b);
}
template<class T>
T normalize(T x, T mod = 1000000007)
{
	return (((x % mod) + mod) % mod);
}
static long long randomizell(long long mod)
{
	return ((1ll << 45) * rand() + (1ll << 30) * rand() + (1ll << 15) * rand() + rand()) % mod;
}
static int randomize(int mod)
{
	return ((1ll << 15) * rand() + rand()) % mod;
}

#define y0 ___y0
#define y1 ___y1
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define debug(x) cerr << #x << " = " << x << endl;

const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-10;

#define MAGIC 347
#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll
#define MAXN 1313

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

static int N;
static vector<pii> edges, isbits;
static vector<int> edge[MAXN];
static int bt[MAXN], id[MAXN];
static bool isbit[MAXN], inlone[MAXN];
static int lone, control;

void finish()
{
	// for (pii x : edges)
	// {
	// 	cerr << "solve " << x.fi << ' ' << x.se << endl;
	// }
	InitMap(N - 12, edges.size());
	for (pii x : edges)
	{
		MakeMap(x.fi, x.se);
	}
	return;
}
void Bob(int n, int m, int a[], int b[])
{
	N = n;
	// if (N == 12)
	// {
	// 	finish();
	// 	return;
	// }
	// if (N == 13)
	// {
	// 	finish();
	// 	return;
	// }
	for (int i = 0; i < m; i++)
	{
		edge[b[i]].PB(a[i]);
	}
	int freq = 0;
	for (int i = 0; i < N; i++)
	{
		if (edge[i].size() == N - 2)
		{
			lone = i;
			freq++;
		}
	}
	if (freq != 1)
	{
		finish();
		return;
	}
	// assert(freq == 1);
	// cerr << "lone " << lone << endl;
	for (int x : edge[lone])
	{
		inlone[x] = true;
	}
	for (int i = 0; i < N; i++)
	{
		if (i != lone && !inlone[i])
		{
			control = i;
		}
	}
	// cerr << "control " << control << endl;
	for (int x : edge[control])
	{
		isbits.PB(MP(x, 0));
		isbit[x] = true;
		// cerr << "isbit " << x << endl;
	}
	for (pii &p : isbits)
	{
		int u = p.fi;
		for (int v : edge[u])
		{
			if (isbit[v])
			{
				p.se++;
			}
		}
		bt[p.se]= u;
	}
	for (int i = 0; i < 10; i++)
	{
		int u = bt[i];
		for (int v : edge[u])
		{
			if (isbit[v] || v == control ||  v == lone)
			{
				continue;
			}
			id[v] += (1 << i);
		}
	}
	for (int u = 0; u < N; u++)
	{
		if (isbit[u] || u == control || u == lone)
		{
			continue;
		}
		// cerr << "id " << u << " = " << id[u] << endl;
		for (int v : edge[u])
		{
			if (isbit[v] || v == control || v == lone)
			{
				continue;
			}
			edges.PB(MP(id[u], id[v]));
		}
	}
	finish();
}



    

Compilation message

Alice.cpp: In function 'void Bob(int, int, int*, int*)':
Alice.cpp:173:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (edge[i].size() == N - 2)
       ~~~~~~~~~~~~~~~^~~~~~~~
Alice.cpp: At global scope:
Alice.cpp:97:12: warning: 'int randomize(int)' defined but not used [-Wunused-function]
 static int randomize(int mod)
            ^~~~~~~~~
Alice.cpp:93:18: warning: 'long long int randomizell(long long int)' defined but not used [-Wunused-function]
 static long long randomizell(long long mod)
                  ^~~~~~~~~~~
/tmp/cc6OOWcx.o: In function `main':
grader_alice.cpp:(.text.startup+0xe1): undefined reference to `Alice(int, int, int*, int*)'
/tmp/ccSdKFLZ.o: In function `finish()':
Alice.cpp:(.text+0x52): undefined reference to `InitMap(int, int)'
Alice.cpp:(.text+0x7a): undefined reference to `MakeMap(int, int)'
collect2: error: ld returned 1 exit status

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