QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#847097#141. 8 染色DengDuckCompile Error//C++141.1kb2025-01-07 17:18:162025-01-07 17:18:19

Judging History

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

  • [2025-01-07 17:18:19]
  • 评测
  • [2025-01-07 17:18:16]
  • 提交

Alice

#include<bits/stdc++.h>
#include"Alice.h"
#define Vi vector<int>
using namespace std;
Vi Alice(int n,int m,Vi U,Vi V,Vi C)
{
	Vi X,D(n);
	for(int i:U)D[i]++;
	for(int i:V)D[i]++;
	for(int i=0;i<n;i++)if(D[i]>=8)X.push_back(C[i]>>1&1),X.push_back(C[i]>>2&1);
	return X;
}

Bob

#include<bits/stdc++.h>
#include"Bob.h"
#define Vi vector<int>
using namespace std;
Vi Bob(int n,int m,Vi U,Vi V,Vi X)
{
	Vi C(n),F(n);vector<Vi>E(n);
	for(int i=0;i<m;i++)E[U[i]].push_back(V[i]),E[V[i]].push_back(U[i]);
	for(int i=n-1;~i;i--)if(E[i].size>=8)C[i]|=X.back()<<2,X.pop_back(),C[i]|=X.back()<<1,X.pop_back();
	for(int i=0;i<n;i++)
	{
		if(E[i].size()>=8&&!F[i])
		{
			queue<int>Q;F[i]=1,Q.push(i);
			while(!Q.empty())
			{
				int u=Q.front();Q.pop();
				for(int v:E[u])
				{
					if(!F[v]&&(C[u]>>1)==(C[x]>>1)&&E[v].size()>=8)
					C[v]=C[u]^1,Vis[v]=1,Q.push(v);
				}
			}
		}
	}
	for(int u=0;u<n;u++)
	if(E[u].size()<8)
	{
		Vi S[8];
		for(int v:E[u])if(E[v].size()>=8||v<u)S[C[v]]=1;
		for(int i=0;i<8;i++)
		if(!S[i])
		{
			C[u]=i;
			break;
		}
	}
	return C;
}

详细

Bob.code: In function ‘std::vector<int> Bob(int, int, std::vector<int>, std::vector<int>, std::vector<int>)’:
Bob.code:9:38: error: invalid use of member function ‘std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’ (did you forget the ‘()’ ?)
    9 |         for(int i=n-1;~i;i--)if(E[i].size>=8)C[i]|=X.back()<<2,X.pop_back(),C[i]|=X.back()<<1,X.pop_back();
      |                                          ()
Bob.code:20:65: error: ‘x’ was not declared in this scope
   20 |                                         if(!F[v]&&(C[u]>>1)==(C[x]>>1)&&E[v].size()>=8)
      |                                                                 ^
Bob.code:21:53: error: ‘Vis’ was not declared in this scope; did you mean ‘Vi’?
   21 |                                         C[v]=C[u]^1,Vis[v]=1,Q.push(v);
      |                                                     ^~~
      |                                                     Vi
Bob.code:30:63: error: no match for ‘operator=’ (operand types are ‘std::vector<int>’ and ‘int’)
   30 |                 for(int v:E[u])if(E[v].size()>=8||v<u)S[C[v]]=1;
      |                                                               ^
In file included from /usr/include/c++/11/vector:72,
                 from /usr/include/c++/11/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:86,
                 from Bob.code:1:
/usr/include/c++/11/bits/vector.tcc:198:5: note: candidate: ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]’
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from ‘int’ to ‘const std::vector<int>&’
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:86,
                 from Bob.code:1:
/usr/include/c++/11/bits/stl_vector.h:709:7: note: candidate: ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]’
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from ‘int’ to ‘std::vector<int>&&’
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:730:7: note: candidate: ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]’
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from ‘int’ to ‘std::initializer_list<int>’
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Bob.code:32:20: error: no match for ‘operator!’ (operand type is ‘std::vector<int>’)
   32 |                 if(!S[i])
      |                    ^~~~~
Bob.code:32:20: note: candidate: ‘operator!(bool)’ (built-in)
Bob.code:32:20: note:   no known conversion for argument 1 from ‘std::vector<int>’ to ‘bool’