QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#506680#141. 8 染色SunsetGlow95Compile Error//C++141.6kb2024-08-05 20:35:432024-08-05 20:35:44

Judging History

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

  • [2024-08-05 20:35:44]
  • 评测
  • [2024-08-05 20:35:43]
  • 提交

Alice

#include "Alice.h"

std::vector <int> Alice(int N, int M, std::vector <int> U, std::vector <int> V, std::vector <int> C) {
  std::vector<int> deg(N);
  for (int i(0); i != M; ++i)
    ++deg[U[i]], ++deg[V[i]];
  std::vector<int> ret;
  for (int i(0); i != N; ++i)
    if (deg[i] > 7)
      ret.push_back((C[i] >> 2) & 1),
      ret.push_back((C[i] >> 1) & 1);
  return ret;
}

Bob

#include "Bob.h"

const int MXN = 200005;
int bc[MXN], ans[MXN];
std::vector<int> to[MXN];
bool vis[8];

void solve_big(int N, int p, int c) {
  ans[p] = (bc[p] << 1) | c;
  for (int q : to[p]) {
    if (bc[q] != bc[p]) continue;
    if (ans[q] == -1) solve_big(N, q, 1 - c);
  }
}
void solve_small(int N, int p) {
  memset(vis, 0, sizeof vis);
  for (int q : to[p]) {
    if (ans[q] == -1) continue;
    vis[ans[q]] = true;
  }
  for (int i(0); i != 8; ++i)
    if (!vis[i]) {
      ans[p] = i;
      continue;
    }
  for (int q : to[p]) {
    if (ans[q] == -1) solve_small(N, q);
  }
}

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)
    to[U[i]].push_back(V[i]), to[V[i]].push_back(U[i]);
  memset(bc, sizeof bc, -1);
  for (int i(0), j(0); i != N; ++i)
    if (to[i].size() > 7)
      bc[i] = (X[j] << 1 | X[j + 1]), j += 2;
  memset(ans, -1, sizeof ans);
  for (int i(0); i != N; ++i) {
    if (bc[i] != -1 && ans[i] == -1)
      solve_big(N, i, 0);
  }
  for (int i(0); i != N; ++i) {
    if (bc[i] == -1 && ans[i] == -1)
      solve_small(N, i);
  }
  return std::vector<int>(ans, ans + N);
}

Details

Bob.code: In function ‘void solve_small(int, int)’:
Bob.code:16:3: error: ‘memset’ was not declared in this scope
   16 |   memset(vis, 0, sizeof vis);
      |   ^~~~~~
Bob.code:2:1: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    1 | #include "Bob.h"
  +++ |+#include <cstring>
    2 | 
Bob.code: In function ‘std::vector<int> Bob(int, int, std::vector<int>, std::vector<int>, std::vector<int>)’:
Bob.code:34:3: error: ‘memset’ was not declared in this scope
   34 |   memset(bc, sizeof bc, -1);
      |   ^~~~~~
Bob.code:34:3: note: ‘memset’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?