답안 #710246

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
710246 2023-03-15T06:04:20 Z pcc 길고양이 (JOI20_stray) C++14
컴파일 오류
0 ms 0 KB
#include "Anthony.h"
#include <vector>
#include <queue>

namespace {

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

}  testing;

using namespace std;
std::vector<int> Mark(int N, int M, int A, int B,std::vector<int> U, std::vector<int> V) {
    vector<vector<pair<int,int>> paths(N);
    for(int i = 0;i<M;i++){
      paths[U[i]].push_back({V[i],i});
      paths[V[i]].push_back({U[i],i});
    }
    vector<int> dist(N,-1);
    vector<int> col(M);
    dist[0] = 0;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
      auto now = q.front();
      q.pop();
      for(auto nxt:paths[now]){
        if(dist[nxt.first] != -1)continue;
        dist[nxt.first] = nxt.second+1;
        col[nxt.second] = dist[nxt.first]%3;
        q.push(nxt.first);
      }
    }
    return col;
}
#include "Catherine.h"
#include <set>
#include <vector>

namespace {

int A, B;
int variable_example = 0;

}  test;

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

using namespace std;
int Move(std::vector<int> y) {
  set<int> st;
  st.insert(1);
  st.insert(2);
  st.insert(0);
  for(int i = 0;i<3;i++)if(y[i])st.erase(i);
  if(st.size() == 2){
    for(int i = 0;i<3;i++)if(y[i])return i;
  }
  if(*st.begin() == 0)return 1;
  else if(*st.begin() == 1)return 2;
  else return 0;
  ++variable_example;
  return -1;
}

Compilation message

Anthony.cpp:11:4: error: 'testing' does not name a type
   11 | }  testing;
      |    ^~~~~~~
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:15:41: error: template argument 1 is invalid
   15 |     vector<vector<pair<int,int>> paths(N);
      |                                         ^
Anthony.cpp:15:41: error: template argument 2 is invalid
Anthony.cpp:17:7: error: 'paths' was not declared in this scope
   17 |       paths[U[i]].push_back({V[i],i});
      |       ^~~~~
Anthony.cpp:28:20: error: 'paths' was not declared in this scope
   28 |       for(auto nxt:paths[now]){
      |                    ^~~~~
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) {
      |     ^~~~~~~~~~~~~~~

Catherine.cpp:10:4: error: 'test' does not name a type
   10 | }  test;
      |    ^~~~
Catherine.cpp: In function 'void Init(int, int)':
Catherine.cpp:13:3: error: 'test' has not been declared
   13 |   test::A = A;
      |   ^~~~
Catherine.cpp:14:3: error: 'test' has not been declared
   14 |   test::B = B;
      |   ^~~~
Catherine.cpp: At global scope:
Catherine.cpp:7:8: warning: '{anonymous}::B' defined but not used [-Wunused-variable]
    7 | int A, B;
      |        ^
Catherine.cpp:7:5: warning: '{anonymous}::A' defined but not used [-Wunused-variable]
    7 | int A, B;
      |     ^