QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#850207#141. 8 染色xujindongCompile Error//C++141.1kb2025-01-09 21:47:422025-01-09 21:47:46

Judging History

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

  • [2025-01-09 21:47:46]
  • 评测
  • [2025-01-09 21:47:42]
  • 提交

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<int>x,deg(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)x.push_back(c[i]>>2),x.push_back(c[i]>>1&1);
  return x;
}

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<int>deg(n),c(n,-1),e[n],vis(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=0,cnt=0;i<n;i++)if(e[i].size()>=8)c[i]=x[cnt]<<1|x[cnt+1],cnt+=2;
  for(int i=0;i<n;i++){
    if(c[i]!=-1&&!vis[i]){
      queue<int>q;
      c[i]<<=1,vis[i]=1,q.push(i);
      while(!q.empty()){
        int now=q.front();
        q.pop();
        for(auto v:e[now])if(!vis[v]&&c[v]==c[now]>>1)c[v]=c[now]^1,vis[v]=1,q.push(v);
      }
    }
  }
  for(int i=0;i<n;i++){
    if(c[i]!=-1)continue;
    vector<bool>t(8);
    for(auto v:e[now])if(c[v]!=-1)t[c[v]]=1;
    for(int j=0;j<8;j++)if(!t[j])c[i]=j;
  }
  return c;
}

詳細信息

Bob.code: In function ‘std::vector<int> Bob(int, int, std::vector<int>, std::vector<int>, std::vector<int>)’:
Bob.code:22:18: error: ‘now’ was not declared in this scope; did you mean ‘pow’?
   22 |     for(auto v:e[now])if(c[v]!=-1)t[c[v]]=1;
      |                  ^~~
      |                  pow