QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#89448#141. 8 染色Dr_Gilbert0 29ms18228kbC++141.7kb2023-03-20 07:55:412023-03-20 07:55:42

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:55:42]
  • 评测
  • 测评结果:0
  • 用时:29ms
  • 内存:18228kb
  • [2023-03-20 07:55:41]
  • 提交

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;queue<int> que;
	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(vis.begin(),vis.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;
}

详细

Test #1:

score: 0
Wrong Answer
time: 29ms
memory: 18228kb

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
+010000111001001000000101010000011000110010001111001001000100100101000101110000101111011111010111000110101010010011101100110011100101001001101101010101011101010001101011001110110111001010000001100000010111001101010110010011001011011110101011110000111000111001010110000011101110001001100011111...

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

result:

wrong answer the color of the vertex 5247 and 482 is the same