답안 #562966

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
562966 2022-05-15T20:09:24 Z aryan12 Amusement Park (JOI17_amusement_park) C++17
컴파일 오류
0 ms 0 KB
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;

#define MAXN 10010
#define INF 1000000000

static vector<int> g[MAXN];
static vector<long long> dist(MAXN, INF);
static vector<bool> vis(MAXN, false);
static vector<int> parent(MAXN);

static long long ans = 0;
static set<int> already_taken;

static int Find(int x)
{
    if(x == parent[x]) return x;
    return parent[x] = Find(parent[x]);
}

static void Unite(int a, int b)
{
    a = Find(a), b = Find(b);
    parent[a] = b;
}

static void dfs(int node, int par, long long val)
{
    // cout << "node = " << node << ", val = " << val << "\n";
    // cout << "ans = " << ans << "\n";
    if(vis[node])
    {
        assert(par != -1);
        int value = Move(par);
        return;
    }
    vis[node] = true;
    if(val == 1 && !already_taken.count(dist[node] % 60))
    {
        long long x = dist[node] % 60;
        ans += (1LL << x);
        already_taken.insert(x);
    }
    for(int to: g[node])
    {
        // cout << "to: " << to << "\n";
        if(!vis[to])
        {
            int value = Move(to);
            dfs(to, node, value);
        }
    }
    if(par != -1)
    {
        int value = Move(par);
    }
}

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) 
{
    for(long long i = 0; i < N; i++)
    {
        parent[i] = i;
    }
    int cnt = 0;
    for(int i = 0; i < M; i++)
    {
        if(Find(A[i]) != Find(B[i]))
        {
            Unite(A[i], B[i]);
            g[A[i]].push_back(B[i]);
            g[B[i]].push_back(A[i]);
            cnt++;
        }
    }
    assert(cnt == N - 1);
    dist[0] = 0LL;
    queue<int> q;
    q.push(0);
    while(!q.empty())
    {
        int node = q.front();
        q.pop();
        for(int to: g[node])
        {
            if(dist[to] == 1e9)
            {
                dist[to] = dist[node] + 1;
                q.push(to);
            }
        }
    }
    dfs(P, -1, (long long)(V));
    return ans;
}



    

Compilation message

Joi.cpp: In function 'void dfs(int, int, long long int)':
Joi.cpp:35:21: error: 'Move' was not declared in this scope
   35 |         int value = Move(par);
      |                     ^~~~
Joi.cpp:35:13: warning: unused variable 'value' [-Wunused-variable]
   35 |         int value = Move(par);
      |             ^~~~~
Joi.cpp:50:25: error: 'Move' was not declared in this scope
   50 |             int value = Move(to);
      |                         ^~~~
Joi.cpp:56:21: error: 'Move' was not declared in this scope
   56 |         int value = Move(par);
      |                     ^~~~
Joi.cpp:56:13: warning: unused variable 'value' [-Wunused-variable]
   56 |         int value = Move(par);
      |             ^~~~~

/usr/bin/ld: /tmp/ccX8ooP1.o: in function `main':
grader_ioi.cpp:(.text.startup+0x3f2): undefined reference to `Ioi(int, int, int*, int*, int, int, int)'
collect2: error: ld returned 1 exit status