Submission #1145906

#TimeUsernameProblemLanguageResultExecution timeMemory
1145906bozhoEaster Eggs (info1cup17_eastereggs)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

const int MAX = 550;

vector<int> v[MAX], order;
bool used[MAX];

bool Checker(int x)
{
    vector<int> c;
    for (int i = 0; i <= x; i++)
    {
        c.push_back(order[i]);
    }
    return query(c);
}

int Binary()
{
    int l = -1, r = order.size(), m;
    while (r - l > 1)
    {
        m = l + (r - l) / 2;
        if (Checker(m))
            r = m;
        else
            l = m;
    }
    return r;
}

void Dfs(int g)
{
    used[g] = 1;
    order.push_back(g);
    for (int i = 0; i < v[g].size(); i++)
    {
        if (!used[v[g][i]])
            Dfs(v[g][i]);
    }
}

int findEgg(int n, vector<pair<int, int>> p)
{
    for (int i = 0; i < p.size(); i++)
    {
        v[p[i].first].push_back(p[i].second);
        v[p[i].second].push_back(p[i].first);
    }
    Dfs();
    bool ans = Binary();
    for (int i = 0; i <= n; i++)
    {
        v[i].clear();
        used[i] = 0;
    }
    order.clear();
    return ans;
}

Compilation message (stderr)

eastereggs.cpp: In function 'bool Checker(int)':
eastereggs.cpp:17:12: error: 'query' was not declared in this scope
   17 |     return query(c);
      |            ^~~~~
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:52:8: error: too few arguments to function 'void Dfs(int)'
   52 |     Dfs();
      |     ~~~^~
eastereggs.cpp:34:6: note: declared here
   34 | void Dfs(int g)
      |      ^~~