QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#89446#141. 8 染色Dr_GilbertCompile Error//C++141.7kb2023-03-20 07:54:432023-03-20 07:54:45

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-20 07:54:45]
  • 评测
  • [2023-03-20 07:54:43]
  • 提交

Alice

#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
vector<int> Alice(int n, int m, vector<int> u, vector<int> v, vector<int> c){
	vector<vector<int>> G;G.resize(n+10);
	vector<int> deg(n+10),vis(n+10);
	for (int i=0;i<m;i++){
		G[u[i]+1].emplace_back(v[i]+1);
		G[v[i]+1].emplace_back(u[i]+1);
		deg[v[i]+1]++;deg[u[i]+1]++;
	}for (int i=1;i<=n;i++){
		if (deg[i]<8) vis[i]=1;
	}vector<int> vec;
	for (int i=1;i<=n;i++){
		// if (vis[i]) continue;
		vec.emplace_back(((c[i-1]>>1)&2)>>1);
		vec.emplace_back((c[i-1]>>1)&1);
	}return vec;
}

Bob

#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
vector<int> Bob(int n, int m, vector<int> u, vector<int> v, vector<int> x){
	vector<vector<int>> G;G.resize(n+10);
	vector<int> deg(n+10),vis(n+10);
	for (int i=0;i<m;i++){
		G[u[i]+1].emplace_back(v[i]+1);
		G[v[i]+1].emplace_back(u[i]+1);
		deg[v[i]+1]++;deg[u[i]+1]++;
	}for (int i=1;i<=n;i++){
		if (deg[i]<8) vis[i]=1;
	}vector<int> col(n+10);
	int pos=0;
	for (int i=1;i<=n;i++){
		// if (vis[i]) {col[i]=-1;continue;}
		col[i]=(x[pos]<<1)+x[pos+1];col[i]<<=1;pos+=2;
	}fill(vec.begin(),vec.end(),0);
	for (int i=1;i<=n;i++){
		if (vis[i]) continue;
		que.emplace(i);
		while (que.size()){
			int x=que.front();que.pop();
			for (int v:G[x]){
				if (vis[v]) continue;
				if (col[x]==col[v]){
					col[v]=col[x]^1;
				}que.emplace(v);vis[v]=1;
			}
		}
	}for (int i=1;i<=n;i++){
		if (col[i]!=-1) continue;
		int S=(1<<8)-1;
		for (int v:G[i]){
			if (col[v]!=-1&&(S&(1<<col[v]))){
				S^=(1<<col[v]);
			}
		}for (int j=0;j<8;j++){
			if (S&(1<<j)){col[i]=j;break;}
		}
	}vector<int> res;
	for (int i=1;i<=n;i++){
		res.emplace_back(col[i]);
	}return res;
}

Details

Bob.code: In function ‘std::vector<int> Bob(int, int, std::vector<int>, std::vector<int>, std::vector<int>)’:
Bob.code:18:15: error: ‘vec’ was not declared in this scope
   18 |         }fill(vec.begin(),vec.end(),0);
      |               ^~~
Bob.code:21:17: error: ‘que’ was not declared in this scope
   21 |                 que.emplace(i);
      |                 ^~~