Submission #710188

# Submission time Handle Problem Language Result Execution time Memory
710188 2023-03-15T05:36:30 Z MinhAnhnd Stray Cat (JOI20_stray) C++14
Compilation error
0 ms 0 KB
#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>

namespace {

int FunctionExample(int i, int A) {
  return i % A;
}



} // namespace

std::vector<int> Mark(int N, int M, int A, int B,
                      std::vector<int> U, std::vector<int> V) {
  std::vector<int> adj[20001];
  int index[20001] = {};
  std::vector<int> X(M);
  std::queue<int> bfs;
  bfs.push(0);
  index[0] = 1;
  for (int i = 0; i < M; ++i) {
    adj[U[i]].push_back(V[i]);
    adj[V[i]].push_back(U[i]);
  }
  while(!bfs.empty()){
    int node = bfs.back();
    bfs.pop();
    for(auto child:adj[node]){
        if(index[child]==0){
            index[child] = index[node] + 1;
            if(index[child]==4) index[child] = 1;
            bfs.push(child);
        }
    }
  }
  for (int i = 0; i < M; ++i) {
    int nodeA = index[U[i]];
    int nodeB = index[V[i]];
    if(nodeA > nodeB) swap(nodeA,nodeB);
    if((nodeA == 1)&&(nodeB == 2)) X[i] = 0;
    if((nodeA == 2)&&(nodeB == 3)) X[i] = 1;
    if((nodeA == 1)&&(nodeB == 3)) X[i] = 2;
    if((nodeA == 2)&&(nodeB == 2)) X[i] = 1;
    if((nodeA == 3)&&(nodeB == 3)) X[i] = 2;
    if((nodeA == 1)&&(nodeB == 1)) X[i] = 0;
  }
  return X;
}
#include "Catherine.h"
#include <vector>

namespace {

int A, B;
int variable_example = 0;
}  // namespace

using namespace std;

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

}

int Move(std::vector<int> y) {
  ++variable_example;
  /*for (int j = 0; j < A; ++j) {
    if (y[j] != 0) {
      return j;
    }
  }*/
  if (y[0]==0){
    if (y[1]==0){
        return 2;
    }
    else return 1;
  }

  if (y[1]==0){
    if (y[2]==0){
        return 0;
    }
    else return 2;
  }

  if (y[2]==0){
    if (y[0]==0){
        return 1;
    }
    else return 0;
  }

  return -1;
}

Compilation message

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:41:23: error: 'swap' was not declared in this scope
   41 |     if(nodeA > nodeB) swap(nodeA,nodeB);
      |                       ^~~~
Anthony.cpp:41:23: note: suggested alternatives:
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from Anthony.cpp:3:
/usr/include/c++/10/bits/regex.h:2141:5: note:   'std::__cxx11::swap'
 2141 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
In file included from /usr/include/c++/10/bits/stl_pair.h:59,
                 from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from Anthony.h:5,
                 from Anthony.cpp:1:
/usr/include/c++/10/bits/move.h:189:5: note:   'std::swap'
  189 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
In file included from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/new:41,
                 from /usr/include/c++/10/ext/new_allocator.h:33,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33,
                 from /usr/include/c++/10/bits/allocator.h:46,
                 from /usr/include/c++/10/vector:64,
                 from Anthony.h:5,
                 from Anthony.cpp:1:
/usr/include/c++/10/bits/exception_ptr.h:169:5: note:   'std::__exception_ptr::swap'
  169 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
Anthony.cpp: At global scope:
Anthony.cpp:7:5: warning: 'int {anonymous}::FunctionExample(int, int)' defined but not used [-Wunused-function]
    7 | int FunctionExample(int i, int A) {
      |     ^~~~~~~~~~~~~~~