Submission #995694

# Submission time Handle Problem Language Result Execution time Memory
995694 2024-06-09T18:05:22 Z popu Tropical Garden (IOI11_garden) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

#define f first
#define s second

using namespace std;

vector<vector<int>> graf, res;
int curr, gres[2005];

void dfs(int node, int tata, vector<bool> vis)
{
    res[curr].push_back(node);
    ///cout << node << ' ';
    vis[node] = 1;
    if(graf[node].size() == 1)
    {
        dfs(graf[node][0], node, vis);
    }
    else
    {
        if(tata == graf[node][0] && !vis[graf[node][1]])
            dfs(graf[node][1], node, vis);
        else if(!vis[graf[node][0]])
            dfs(graf[node][0], tata, vis);
    }
}

void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
    graf.resize(N + 1);
    res.resize(N + 1);
    for(int i = 0; i < M; i++)
    {
        graf[R[i][0]].push_back(R[i][1]);
        graf[R[i][1]].push_back(R[i][0]);
    }

    vector<bool> vis;
    vis.resize(N + 1);
    for(int i = 0; i < N; i++)
    {
        curr = i;
        dfs(i, -1, vis);
    }
    for(int j = 0; j < Q; j++)
    {
        for(int i = 0; i < N; i++)
        {
            if(res[i][G[j] % res[i].size()] == P)
                gres[j]++;
        }
        answer(gres[j]);
    }
}

Compilation message

garden.cpp: In function 'void count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:53:9: error: 'answer' was not declared in this scope
   53 |         answer(gres[j]);
      |         ^~~~~~