Submission #1145958

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

const int MAX = 550;

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

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

int Binary()
{
    vector<int> c;
    for (int i = 0; i < order.size(); i++)
    {
        c.push_back(order[i]);
        if (query(c))
            return order[i];
    }
}

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(1);
    int 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:15:9: error: 'c' was not declared in this scope
   15 |         c.push_back(order[i]);
      |         ^
eastereggs.cpp:17:18: error: 'c' was not declared in this scope
   17 |     return query(c);
      |                  ^
eastereggs.cpp: In function 'int Binary()':
eastereggs.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^