Submission #802559

# Submission time Handle Problem Language Result Execution time Memory
802559 2023-08-02T12:45:32 Z Um_nik Stray Cat (JOI20_stray) C++17
Compilation error
0 ms 0 KB
#include "Anthony.h"
#include <vector>
using namespace std;

namespace {

}  // namespace

vector<int> Mark(int N, int M, int A, int B,
                      vector<int> U, vector<int> V) {
  vector<int> X(M);
  if (A >= 3) {
    vector<vector<int>> g(N, vector<int>());
    for (int i = 0; i < M; i++) {
      int u = U[i], v = V[i];
      g[u].push_back(v);
      g[v].push_back(u);
    }
    vector<int> dist(N, N);
    dist[0] = 0;
    vector<int> q;
    q.push_back(0);
    for (int i = 0; i < (int)q.size(); i++) {
      int v = q[i];
      for (int u : g[v]) if (dist[u] == N) {
        dist[u] = dist[v] + 1;
        q.push_back(u);
      }
    }
    assert((int)q.size() == N);
    for (int i = 0; i < M; i++)
      X[i] = min(dist[U[i]], dist[V[i]]) % 3;
  } else {
    assert(false);
  }
  return X;
}
#include "Catherine.h"
#include <vector>

namespace {

int A, B;

}  // namespace

void Init(int A, int B) {
  ::A = A;
}

int Move(std::vector<int> y) {
  if (A > 2) {
    int c = 0;
    while(c < 3) {
      if (y[c] > 0 && y[(c + 2) % 3] == 0) break;
      c++;
    }
    assert(c < 3);
    return c;
  } else {
    assert(false);
  }
}

Compilation message

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:30:5: error: 'assert' was not declared in this scope
   30 |     assert((int)q.size() == N);
      |     ^~~~~~
Anthony.cpp:2:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    1 | #include "Anthony.h"
  +++ |+#include <cassert>
    2 | #include <vector>
Anthony.cpp:34:5: error: 'assert' was not declared in this scope
   34 |     assert(false);
      |     ^~~~~~
Anthony.cpp:34:5: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:21:5: error: 'assert' was not declared in this scope
   21 |     assert(c < 3);
      |     ^~~~~~
Catherine.cpp:2:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    1 | #include "Catherine.h"
  +++ |+#include <cassert>
    2 | #include <vector>
Catherine.cpp:24:5: error: 'assert' was not declared in this scope
   24 |     assert(false);
      |     ^~~~~~
Catherine.cpp:24:5: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
Catherine.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
Catherine.cpp: At global scope:
Catherine.cpp:6:8: warning: '{anonymous}::B' defined but not used [-Wunused-variable]
    6 | int A, B;
      |        ^