QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#84656#141. 8 染色Appleblue170 20ms23444kbC++142.1kb2023-03-06 16:38:042023-03-06 16:38:14

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-06 16:38:14]
  • 评测
  • 测评结果:0
  • 用时:20ms
  • 内存:23444kb
  • [2023-03-06 16:38:04]
  • 提交

Alice

#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;
const int B=8;
namespace {
	const int N=2e5+5;
	vector <int> G[N];
	int in[N];
	queue <int> q;
	
	vector <int> ANS;
}

std::vector <int> Alice(int n, int m, std::vector <int> U, std::vector <int> V, std::vector <int> C) {
	for(int i=0;i<m;i++){
		int u=U[i]+1,v=V[i]+1;
		G[u].push_back(v),G[v].push_back(u);
		in[u]++,in[v]++;
	}
	for(int i=1;i<=n;i++){
		if(in[i]<B) q.push(i);
	}
	while(q.size()){
		int u=q.front(); q.pop();
		for(int v: G[u]){
			if(in[v]<B) continue;
			in[v]--;
			if(in[v]<B) q.push(v);
		}
	}
	
	for(int i=1;i<=n;i++){
		if(in[i]>=B){
			for(int t=0;t<2;t++) ANS.push_back(C[i-1]>>t & 1);
		}
	}
	ANS.push_back(0);
//	cout<<"Alice send: ";
//	for(int x: ANS) cout<<x<<" ";
//	cout<<'\n';
	return ANS;
}

Bob

#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;
const int B=8;
namespace {
	const int N=2e5+5;
	vector <int> G[N];
	int in[N];
	queue <int> q;
	
	stack <int> sta;
	int col[N];
	
	bool vis[N];
	void dfs(int u,int c){
		if(col[u]==-1 || vis[u]) return ;
		vis[u]=1;
		col[u] |= c<<2;
		for(int v: G[u]){
			dfs(v,c^1);
		}
	}
	
	
	vector <int> ANS;
}

std::vector <int> Bob(int n, int m, std::vector <int> U, std::vector <int> V, std::vector <int> X) {
	for(int i=0;i<m;i++){
		int u=U[i]+1,v=V[i]+1;
		G[u].push_back(v),G[v].push_back(u);
		in[u]++,in[v]++;
	}
	for(int i=1;i<=n;i++){
		if(in[i]<B) q.push(i),sta.push(i);
	}
	while(q.size()){
		int u=q.front(); q.pop();
		for(int v: G[u]){
			if(in[v]<B) continue;
			in[v]--;
			if(in[v]<B) q.push(v),sta.push(v);
		}
	}
	int nw=0;
	for(int i=1;i<=n;i++){
		if(in[i]>=B){
			for(int t=0;t<2;t++) col[i] |= X[nw]<<t,nw++;
		}
		else col[i]=-1;
	}
	
	for(int i=1;i<=n;i++) dfs(i,0);
	
	while(sta.size()){
		int u=sta.top(); sta.pop();
		bool buc[B]={};
		for(int v: G[u])
			if(col[v]>=0) buc[col[v]]=1;
		int nw=0;
		while(buc[nw]) nw++;
		col[u]=nw;
	}
	for(int i=1;i<=n;i++) ANS.push_back(col[i]);
//	cout<<"Bob send: ";
//	for(int x: ANS) cout<<x<<" ";
//	cout<<'\n';
	return ANS;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 20ms
memory: 23444kb

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
1100000100111000101001011100100100101110001001110010111001101001110001011110100001111111111101110001101000101100111001000110110001111000010011111111111101011100110000011001101111010000001010011000000111010011110101001110111010010111100010111110100110100110011101000010010011000000110010110111...

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
3 4 0 6 4 7 1 0 5 5 2 2 3 0 5 2 0 5 3 1 4 1 2 7 0 1 3 5 2 5 5 2 3 4 2 2 7 1 5 0 6 7 3 7 3 7 6 7 0 2 1 5 0 1 7 4 3 5 2 4 6 5 7 4 6 7 5 0 6 0 3 3 7 3 3 3 6 2 7 4 3 4 0 2 1 2 5 7 3 2 4 4 4 1 1 6 1 4 0 2 7 6 4 7 7 6 2 0 3 1 3 1 5 2 2 3 1 0 1 3 7 5 1 6 1 5 6 5 2 7 2 4 0 1 6 0 3 4 0 0 3 4 5 7 6 3 ...

result:

wrong answer the color of the vertex 1613 and 67 is the same