QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#84693#141. 8 染色fzj20070 0ms0kbC++141.4kb2023-03-06 16:59:052023-03-06 16:59:17

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:59:17]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-03-06 16:59:05]
  • 提交

Alice

#include<bits/stdc++.h>
#include "Alice.h"
using namespace std;
vector<int> deg,res;
std::vector<int> Alice(int N,int M,std::vector<int> U,std::vector<int> V,std::vector<int> C){
	deg.resize(N);
	for(int i=0;i<M;i++) deg[U[i]]++,deg[V[i]]++;
	for(int i=0;i<N;i++) 
		if(deg[i]==8) res.emplace_back(C[i]&1),res.emplace_back(C[i]>>1&1);
	return res;
}

Bob

#include<bits/stdc++.h>
#include "Bob.h"
using namespace std;
vector<int> g[200005],col,tmp[4],vis;
inline void dfs(int x,int c){
	col[x]=c;
	for(auto v:g[x])
		if(!col[v]&&vis[v]) dfs(v,3-c); 
}
std::vector<int> Bob(int N,int M,std::vector<int> U,std::vector<int> V,std::vector<int> X){
	col.resize(N),vis.resize(N);
	for(int i=0;i<M;i++) g[U[i]].emplace_back(V[i]),g[V[i]].emplace_back(U[i]);
	for(int i=0,j=0;i<N;i++){
		if(g[i].size()<8) continue;
		tmp[X[j]<<1|X[j+1]].emplace_back(i),j+=2;
	}
	for(int k=0;k<4;k++){
		vis.clear();
		for(auto v:tmp[k]) vis[v]=1;
		for(auto v:tmp[k])
			if(!col[v]) dfs(v,1);
		for(auto v:tmp[k]) col[v]+=k+k; 
	} 
	for(int i=0;i<N;i++){
		if(g[i].size()==8) continue; 
		vector<int> now;
		for(auto v:g[i]) 
			if(col[v]) now.emplace_back(col[v]);
		sort(now.begin(),now.end()),now.erase(unique(now.begin(),now.end()),now.end());
		for(int j=0;j<now.size();j++){
			if(now[j]!=j+1){
				col[i]=j+1;
				break;
			}
		}
		if(!col[i]) col[i]=now.size()+1;
	}
	for(int i=0;i<N;i++) col[i]--;
	return col;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Stage 2: Program Bob Runtime Error

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
+

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:

Unauthorized output

result: