Submission #97189

# Submission time Handle Problem Language Result Execution time Memory
97189 2019-02-14T09:49:24 Z maruii None (JOI16_snowy) C++14
Compilation error
0 ms 0 KB
#include "Borislib.h"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
static vector<int> edge[500];
static int A[500], B[500], prt[500], dth[500], piv, pivs[500], chk[500];
static int dfs(int x){
	int ret = 1;
	for(auto &i: edge[x]){
		if(prt[x]==i) continue;
		prt[i] = x;
		dth[i] = dth[x]+1;
		ret = max(ret, dfs(i)%12+1);
	}
	if(!x || ret%12 == 0) chk[x] = 1, pivs[x] = piv, piv += 9;
	return ret;
}
void InitBoris(int N, int AA[], int BB[]) {
	for(int i=0; i<N; ++i) edge[i].clear();
	for(int i=0; i<N-1; ++i){
		A[i] = AA[i], B[i] = BB[i];
		edge[A[i]].push_back(B[i]);
		edge[B[i]].push_back(A[i]);
	}
	for(int i=0; i<N; ++i) sort(edge[i].begin(), edge[i].end());
	piv = N;
	dfs(0);
}

int Boris(int city) {
	int ret = 0;
	while(!chk[city]) ret += Ask(city), city = prt[city];
	for(int i=0; i<9; ++i) ret += Ask(pivs[city]+i)<<i; 
	return ret;
}
#include "Borislib.h"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
static vector<int> edge[500];
static int A[500], B[500], prt[500], dth[500], piv, pivs[500], chk[500];
static int dfs(int x){
	int ret = 0;
	for(auto &i: edge[x]){
		if(prt[x]==i) continue;
		prt[i] = x;
		dth[i] = dth[x]+1;
		ret = max(ret, dfs(i)%12+1);
	}
	if(!x || ret%12 == 0) chk[x] = 1, pivs[x] = piv, piv += 9;
	return ret;
}
void InitBoris(int N, int AA[], int BB[]) {
	for(int i=0; i<N; ++i) edge[i].clear();
	for(int i=0; i<N-1; ++i){
		A[i] = AA[i], B[i] = BB[i];
		edge[A[i]].push_back(B[i]);
		edge[B[i]].push_back(A[i]);
	}
	for(int i=0; i<N; ++i) sort(edge[i].begin(), edge[i].end());
	piv = N;
	dfs(0);
}

int Boris(int city) {
	int ret = 0;
	while(!chk[city]) ret += Ask(city), city = prt[city];
	for(int i=0; i<9; ++i) ret += Ask(pivs[city]+i)<<i; 
	return ret;
}

Compilation message

/tmp/ccIgizfV.o: In function `Boris(int)':
Anya.cpp:(.text+0x149): undefined reference to `Ask(int)'
Anya.cpp:(.text+0x17b): undefined reference to `Ask(int)'
/tmp/cc1Pp7e0.o: In function `main':
grader_anya.cpp:(.text.startup+0xc5): undefined reference to `InitAnya(int, int*, int*)'
grader_anya.cpp:(.text.startup+0x196): undefined reference to `Anya(int*)'
collect2: error: ld returned 1 exit status