답안 #829924

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
829924 2023-08-18T15:54:13 Z Rifal 길고양이 (JOI20_stray) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "Anthony.h"
#include <vector>
using namespace std;
s
namespace {
    const int Max = 2e4 + 5;
    vector<int> v[Max];
    int level[Max];
    void bfs(int s) {
        queue<int> q;
        q.push(s); level[s] = 1;
        while(!q.empty()) {
            int fron = q.front(); q.pop();
            for(auto i : v[fron]) {
                if(level[i] == 0) {
                    level[i] = level[fron] + 1;
                    q.push(i);
                }
                else if(level[i] > level[fron]+1){
                    level[i] = level[fron] + 1;
                    q.push(i);
                }
            }
        }
    }
}

vector<int> Mark(int N, int M, int A, int B,
                      vector<int> U, vector<int> V) {
    vector<int> x;
    for(int i = 0; i < M; i++) {
        v[U[i]].push_back(V[i]);
        v[V[i]].push_back(U[i]);
    }
    bfs(0);
    for(int i = 0; i < M; i++) {
        int a = min(level[U[i]]%3,level[V[i]]%3), b = max(level[U[i]]%3,level[V[i]]%3);
        if(a == 1 && b == 2) x.push_back(1);
        else if(a == 0 && b == 2) x.push_back(2);
        else if(a == 0 && b == 1) x.push_back(0);
        else if(a == b) x.push_back(a);
    }


  return x;
}
#include "Catherine.h"
#include <vector>

using namespace std;
namespace {

int A, B;
int variable_example = 0;

}  // namespace

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

int Move(vector<int> y) {
  ++variable_example; int a = 10, b = -1;
  for (int i = 0; i < A; ++i) {
      if(y[i] != 0) {
        a = min(a,i);
        b = max(b,i);
      }
  }
  if(a == 0 && b == 1) return 0;
  else if(a == 1 && b == 2) return 1;
  else if(a == 0 && b == 2) return 2;
  else if(a == b) return a;


}

Compilation message

Anthony.cpp:5:1: error: 's' does not name a type
    5 | s
      | ^
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:33:9: error: 'v' was not declared in this scope
   33 |         v[U[i]].push_back(V[i]);
      |         ^
Anthony.cpp:36:5: error: 'bfs' was not declared in this scope; did you mean 'ffs'?
   36 |     bfs(0);
      |     ^~~
      |     ffs
Anthony.cpp:38:21: error: 'level' was not declared in this scope
   38 |         int a = min(level[U[i]]%3,level[V[i]]%3), b = max(level[U[i]]%3,level[V[i]]%3);
      |                     ^~~~~
Anthony.cpp:39:22: error: 'b' was not declared in this scope
   39 |         if(a == 1 && b == 2) x.push_back(1);
      |                      ^

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^