QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587750#141. 8 染色Kevin53070 22ms25728kbC++201.5kb2024-09-24 21:26:492024-09-24 21:26:49

Judging History

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

  • [2024-09-24 21:26:49]
  • 评测
  • 测评结果:0
  • 用时:22ms
  • 内存:25728kb
  • [2024-09-24 21:26:49]
  • 提交

Alice

#include<bits/stdc++.h>
using namespace std;
vector<int> Alice(int n,int m,vector<int> u,vector<int> v,vector<int> c)
{
	mt19937 rng(114514);
	vector<int> vec={1,1,4,5,1,4};
	shuffle(vec.begin(),vec.end(),rng);
	return {0};
}

Bob

#include<bits/stdc++.h>
using namespace std;
#define pb emplace_back
#define sz(v) (int)((v).size())
#define color _color
vector<int> G[200200];
int deg[200200],vis[200200];
int color[200200],c2[200200];
void dfs(int u,int c)
{
	c2[u]=c;
	for(auto v:G[u])
		if(!vis[v]&&color[u]==color[v]&&c2[v]==-1)
			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++)
	{
		G[u[i]].pb(v[i]);
		G[v[i]].pb(u[i]);
	}
	for(int i=0;i<n;i++)
		deg[i]=sz(G[i]);
	queue<int> q;
	vector<int> order;
	for(int i=0;i<n;i++)
		if(deg[i]<8)
			q.push(i);
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		order.pb(x);
		vis[x]=1;
		for(auto y:G[x])
		{
			deg[y]--;
			if(deg[y]==7)
				q.push(y);
		}
	}
	int cur=0;
	for(int i=0;i<n;i++)
		if(!vis[i])
		{
			color[i]=(x[cur]<<1)|(x[cur+1]);
			cur+=2;
		}
	memset(c2,-1,sizeof(c2));
	for(int i=0;i<n;i++)
		if(!vis[i]&&c2[i]==-1)
			dfs(i,0);
	for(int i=0;i<n;i++)
		if(!vis[i])
			color[i]=(color[i]<<1)|c2[i];
	reverse(order.begin(),order.end());
	for(auto x:order)
	{
		vis[x]=0;
		int vis[8]={0,0,0,0,0,0,0,0};
		for(auto y:G[x])
			if(!vis[y])
				vis[color[y]]=1;
		while(vis[color[x]])
			color[x]++;
	}
	vector<int> ret(n);
	for(int i=0;i<n;i++)
		ret[i]=color[i];
	return ret;
}

详细

Test #1:

score: 0
Wrong Answer
time: 22ms
memory: 25728kb

input:

10000 500000
5247 482
4774 3796
5245 9386
8794 2818
1911 3240
6925 6008
6313 1737
8668 4913
7892 5444
6740 2271
2100 53
8527 9605
4009 4765
5293 2683
6552 1326
8877 9929
402 9849
8664 6893
1998 7305
155 9477
9753 8036
448 5438
8535 3111
9493 406
7694 2030
5745 6890
5519 3106
8979 5098
9948 2453
5601...

output:

Success
+0

input:

10000 500000
5247 482
4774 3796
5245 9386
8794 2818
1911 3240
6925 6008
6313 1737
8668 4913
7892 5444
6740 2271
2100 53
8527 9605
4009 4765
5293 2683
6552 1326
8877 9929
402 9849
8664 6893
1998 7305
155 9477
9753 8036
448 5438
8535 3111
9493 406
7694 2030
5745 6890
5519 3106
8979 5098
9948 2453
5601...

output:

Failed
the elements of C should be between 0 and 7

result:

wrong answer invalid communication process!