답안 #251804

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
251804 2020-07-22T10:27:21 Z imeimi2000 길고양이 (JOI20_stray) C++17
컴파일 오류
0 ms 0 KB
#include "Anthony.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> Mark(int n, int m, int a, int b, vector<int> U, vector<int> V) {
    if (A > 2) {
        vector<int> dist(n, -1);
        vector<vector<int>> edge(n);
        for (int i = 0; i < m; ++i) {
            edge[U[i]].push_back(V[i]);
            edge[V[i]].push_back(U[i]);
        }
        queue<int> q;
        q.push(0);
        dist[0] = 0;
        while (!q.empty()) {
            int x = q.front();
            for (int i : edge[x]) {
                if (dist[i] != -1) continue;
                q.push(i);
                dist[i] = dist[x] + 1;
            }
        }
        vector<int> ret(m);
        for (int i = 0; i < m; ++i) {
            int u = U[i], v = V[i];
            if (dist[u] > dist[v]) swap(u, v);
            ret[i] = dist[u] % 3;
        }
        return ret;
    }
}
#include "Catherine.h"
#include <bits/stdc++.h>

using namespace std;

static int A, B, pr;

void Init(int a, int b) {
    A = a, B = b;
    pr = -1;
}

int Move(vector<int> cnt) {
    if (A > 2) {
        int sum = 0;
        for (int i : cnt) sum += i > 0;
        if (sum == 1) {
            for (int i = 0; ; ++i) if (cnt[i]) return i;
        }
        else if (sum == 2) {
            for (int i = 0; ; ++i) if (!cnt[i]) return (i + 1) % 3;
        }
        else exit(1);
    }
}

Compilation message

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:7:9: error: 'A' was not declared in this scope
     if (A > 2) {
         ^
Anthony.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

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