답안 #710248

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

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>

void Init(int A, int B) {
  return;
}

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

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:22:5: error: 'variable_example' was not declared in this scope
   22 |   ++variable_example;
      |     ^~~~~~~~~~~~~~~~