QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#167183#141. 8 染色training4usacoCompile Error//C++171.9kb2023-09-07 11:55:332023-09-07 11:55:34

Judging History

你现在查看的是最新测评结果

  • [2023-09-07 11:55:34]
  • 评测
  • [2023-09-07 11:55:33]
  • 提交

Alice

#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int MAXN = 2e5 + 5;

int deg[MAXN];

vector<int> Alice(int n, int m, vector<int> U, vector<int> V, vector<int> c) {
	vector<int> ret;

	for(int i = 0; i < m; ++i) {
		++deg[U[i] + 1]; ++deg[V[i] + 1];
	}

	for(int i = 1; i <= n; ++i) {
		if(deg[i] < 8) continue;

		if(c[i - 1] <= 1) {
			ret.push_back(0); ret.push_back(0);
		}
		else if(c[i - 1] <= 3) {
			ret.push_back(0); ret.push_back(1);
		}
		else if(c[i - 1] <= 5) {
			ret.push_back(1); ret.push_back(0);
		}
		else if(c[i - 1] <= 7) {
			ret.push_back(1); ret.push_back(1);
		}
	}
	return ret;
}

Bob

#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int MAXN = 2e5 + 5;

int val[MAXN], deg[MAXN], color[MAXN];
bool vis[MAXN];
vector<int> adj[MAXN];

void dfs(int u, int c) {
	if(vis[u]) return;
	vis[u] = true;
	color[u] = c;

	for(auto v : adj[u]) {
		if(val[u] == val[v]) dfs(v, c ^ 1);
	}
}

vector<int> Bob(int n, int m, vector<int> U, vector<int> V, vector<int> x) {
	for(int i = 0; i < m; ++i) {
		int a = U[i] + 1, b = V[i] + 1;
		++deg[a]; ++deg[b];
		adj[a].push_back(b); adj[b].push_back(a);
	}

	int idx = 0;
	for(int i = 1; i <= n; ++i) {
		if(deg[i] < 8) continue;

		val[i] = (2 * x[idx++]) + (x[idx++] + 1);
	}

	for(int i = 1; i <= n; ++i) {
		if(val[i] == 0 || vis[i]) continue;
		dfs(i, 0);
	}

	vector<int> ans(n);
	for(int i = 1; i <= n; ++i) {
		if(val[i] == 0) {
			vector<bool> temp(8, false);

			for(auto v : adj[i]) {
				if(val[v]) {
					temp[2 * (val[v] - 1) + color[v]] = true;
				}
			}

			for(int j = 0; j < 8; ++j) {
				if(temp[j]) continue;
				ans[i - 1] = j;
				color[i] = j;
				val[i] = 1;
			}
		}
		else {
			ans[i - 1] = 2 * (val[i] - 1) + color[i];
		}
	}

	return ans;
}

详细

/usr/bin/ld: /tmp/ccdUOuXA.o: in function `main':
grader_Alice.cpp:(.text.startup+0x143): undefined reference to `Alice(int, 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