답안 #446535

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
446535 2021-07-22T10:47:02 Z MilosMilutinovic 늑대인간 (IOI18_werewolf) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define pb push_back

const int MX = 2e5 + 5;

int n, m, q;
vector<int> adj[MX];

bool was[MX][2];

void dfs1(int u, int l) {
	was[u][0] = true;
	for (int v : adj[u]) {
		if (!was[v][0] && v >= l) {
			dfs1(v, l);
		}
	}	
}

void dfs2(int u, int r) {
	was[u][1] = true;
	for (int v : adj[u]) {
		if (!was[v][1] && v <= r) {
			dfs2(v, r);
		}
	}
}

void cl() {
	for (int i = 0; i < n; i++) {
		was[i][0] = false;
		was[i][1] = false;
	}
}

vector<int> check_validaty(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) {
	n = N; m = (int) X.size(); q = (int) L.size();
	for (int i = 0; i < m; i++) {
		adj[X[i]].pb(Y[i]);
		adj[Y[i]].pb(X[i]);
	}
	if (n <= 3000 && m <= 6000 && q <= 3000) {
		vector<int> ans(q);
		for (int i = 0; i < q; i++) {
			cl(); dfs1(S[i], L[i]); dfs2(E[i], R[i]);
			for (int j = 0; j < n; j++) 
				if (was[j][0] && was[j][1]) ans[i] = 1;
		}
		return ans;
	}
}

Compilation message

werewolf.cpp: In function 'std::vector<int> check_validaty(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
/usr/bin/ld: /tmp/ccVP1QIY.o: in function `main':
grader.cpp:(.text.startup+0x377): undefined reference to `check_validity(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status